I am creating a pipe-delimited file from a SQLPLUS query (Oracle 12.1), and the recipients are requesting that I trim the trailing spaces from the header entries. That is, the current output file begins with something like:
EMPLOYEE|EMPLOYEE_ID |FIRST_NAME |M|LAST_NAME |
They would like to receive:
EMPLOYEE|EMPLOYEE_ID|FIRST_NAME|M|LAST_NAME|
I can use the SET TRIMSPOOL ON formatting command to eliminate trailing spaces from the actual data being output, but I cannot find a way to trim the header entries. What am I missing here? If I were on 12.2, I think the
- Edit - My apologies -- my question post got munged somehow and did not all show up. I assume I did something wrong.
The query script begins with:
SELECT
EMPLOYEE,
CONCAT(TRIM(BOTH ' ' FROM EMPLOYEE), '-U') AS EMPLOYEE_ID,
FIRST_NAME,
MIDDLE_INIT,
LAST_NAME,
TO_CHAR("Birth Date", 'MM/DD/YYYY') "Birth Date",
FICA,
"Status",
"Facility",
"Facility Name",
DEPARTMENT,
"Department Name",
"Network ID",
JOB_CODE,
DESCRIPTION,
JOB_CLASS,
The view definition is:
select e.Employee, e.First_Name, e.Middle_Init, e.Last_name, pa.Birthdate "Birth Date",
SUBSTR(TRIM(e.FICA_Nbr),(length(TRIM(e.FICA_Nbr))-5),6) "FICA", e.EMP_STATUS "Status",
e.Process_Level "Facility",
pr.R_Name "Facility Name", E.Department, dc.r_name "Department Name", pa.Comp_Nbr "Network ID",
e.Job_Code, jc.Description, jc.job_class, e.user_level, e.nick_name,
e.hm_dist_co, e.hm_account, e.hm_sub_acct, e.union_code, e.supervisor,
e.date_hired, e.pay_frequency, e.r_shift, e.salary_class, e.exempt_emp, e.stand_hours,
e.stand_amt, e.warn_flag, e.add_allow_per, e.add_allow_hrs, e.add_allow_amt, e.rpt_ins_cost, e.auto_time_rec,
e.last_ded_seq, e.auto_deposit, e.adj_hire_date, e.annivers_date, e.term_date, e.last_cmt_seq,
e.creation_date, e.nbr_fte, e.pension_plan, e.pay_step, e.schedule, e.ebe_amount,
e.sick_pay, e.ot_plan_code, e.deceased, e.bsi_group, e.work_state, e.tax_state, e.tax_province,
e.wc_state, e.tax_county, e.tax_city, e.moving_exp, e.alt_rate_exist, e.pend_act_date, e.pin,
e.tipped, e.email_address, e.activity, e.acct_category, e.max_limit_ovrd, e.sec_lvl, e.sec_location,
e.position, e.work_sched, e.supervisor_ind, e.annual_hours, e.work_county, e.work_city,
e.work_transport, e.tax_school, e.tax_transport, e.fte_total, e.new_hire_date, e.currency_code,
e.curr_nd, e.country_code, e.name_prefix, e.name_suffix, e.work_country,
e.last_name_pre, e.est_remun, e.est_expense, e.bus_nbr_grp, e.qc_ent_nbr_grp, e.wc_province,
e.county, e.railroad_code, e.fst_day_worked, e.last_day_paid, e.lab_dist_flag, e.encumber_flag,
e.effort_flag, e.rpt_curr, e.prmcert_id, e.sndcert_id, e.frng_rate, e.frng_acct_cat,
e.frng_account, e.frng_sub_acct, e.death_date, e.tax_filter, e.remote, e.pub_sec_retire,
e.prmcert_comp, e.sndcert_comp, e.st_status, e.last_name_uc, e.first_name_uc, e.fica_nbr_last4, e.l_index,
pa.company, pa.supp_cntry_cd, pa.hm_phone_cntry, pa.wk_phone_cntry, pa.wk_phone_nbr,
pa.wk_phone_ext, pa.eeo_class, pa.sex, pa.handicap_id, pa.comp_code, pa.comp_nbr, pa.veteran,
pa.birth_city, pa.birth_state, pa.birth_cntry_cd, pa.senior_date, pa.maiden_lst_nm,
pa.maiden_fst_nm, pa.maiden_mi, pa.former_lst_nm, pa.former_fst_nm, pa.former_mi, pa.locat_code,
pa.hire_source, pa.security_code, pa.security_nbr, pa.bargain_unit, pa.clock_nbr, pa.mail_group,
pa.mb_nbr, pa.draft_status, pa.final_rank, pa.cur_status, pa.last_physical, pa.phy_schd, pa.next_physical,
pa.height_ft, pa.height_in, pa.wght, pa.blood_type, pa.parking_lot, pa.parking_space, pa.dr_license,
pa.dr_lic_st, pa.exp_date, pa.dr_lic_class, pa.rev_schedule, pa.next_review, pa.next_rev_code,
pa.last_review, pa.last_mil_seq, pa.last_rev_seq, pa.last_com_seq, pa.last_int_seq, pa.last_bnf_seq,
pa.last_inv_nbr, pa.last_epc_seq, pa.fnctn_group, pa.exclude_flag, pa.nbr_hl_dep, pa.nbr_dn_dep,
pa.life_style_cr, pa.hl_cov_proof, pa.dn_cov_proof, pa.hl_verify_dt, pa.dn_verify_dt, pa.spouse_emp,
pa.sp_emp_addr1, pa.sp_emp_addr2, pa.sp_emp_addr3, pa.sp_emp_addr4, pa.sp_emp_city, pa.sp_emp_state,
pa.sp_emp_zip, pa.sp_emp_country, pa.sp_emp_ph_cntr, pa.sp_emp_ph_nbr, pa.owner_flag, pa.key_emp_flag,
pa.officer, pa.high_comp, pa.smoker, pa.i9_status, pa.i9_alien_nbr, pa.i9_admit_nbr, pa.i9_sta_exp_dt,
pa.i9_doc_nbr_01, pa.i9_doc_nbr_02, pa.i9_doc_type_01, pa.i9_doc_type_02, pa.i9_doc_exp_dt_01,
pa.i9_doc_exp_dt_02, pa.i9_authorize, pa.true_mar_stat, pa.last_pae_seq, pa.primary_care, pa.family_agg,
pa.ben_date_1, pa.ben_date_2, pa.ben_date_3, pa.ben_date_4, pa.ben_date_5, pa.sec_lvl "PA Sec Level",
pa.sec_location "PA Sec Location",
pa.work_zip, pa.height_unit, pa.wght_unit, pa.language_code, pa.religion, pa.disability, pa.supp_phone_cnt,
pa.supp_phone_nbr, pa.consent, pa.aboriginal, pa.visible_min, pa.related_emp, pa.i9_doc_descr_01,
pa.i9_doc_descr_02, pa.bilingual, pa.supp_county, pa.stock_trade, pa.date_assign, pa.user_amount,
pa.estab_patient, pa.prior_cov_mo, pa.medicare_ind, pa.l_index "PA L_Index", pas.Comp_Nbr "Supv ID"
from LAWPROD.Employee e
INNER JOIN LAWPROD.PAEmployee pa
on e.employee = pa.employee
INNER JOIN LAWPROD.PRSystem pr
on ((e.company = pr.company) and (e.process_level = pr.process_level))
INNER JOIN LAWPROD.JobCode jc
on ((e.company = jc.company and e.job_code = jc.Job_Code))
INNER JOIN LAWPROD.HRSuper hs
on ((e.supervisor = hs.code))
INNER JOIN LAWPROD.employee em
on ((hs.employee = em.employee))
INNER JOIN LAWPROD.PAEmployee pas
on ((em.employee = pas.employee))
INNER JOIN LAWPROD.DeptCode dc
on ((e.company = dc.company) and (e.process_level = dc.process_level) and (e.department = dc.department));
set markup csv on delimiter '|' quote off
?set markup csv on
if I were on 12.2 but I am not right now because reasons. Although this may push me into the upgrade.