Beautifying SQL PLUS Output
482684Feb 18 2009 — edited Feb 18 2009Hi All,
Could any one guide me what needs to be changed in my sql script to get the sql output in a required shape. Below are the details.
SQL QUERY Settings:
set linesize 1000 pagesize 100
column p.party_id heading "PARTY_ID" format 99999999999
column pea.mdcd_match_Status heading " MDCD_MATCH|_STATUS" format a10
column p.member_id heading "MEMBER_ID" format a10
column p.first_name heading "FIRST_NAME" format a10
column p.last_name heading "LAST_NAME" format a10
column p.middle_initial heading "MID_INI" format a7
column p.suffix heading "SUFFIX" format a10
column p.gender heading "GENDER" format a6
select p.party_id, pea.mdcd_match_Status,p.member_id,p.first_name,
p.last_name,p.middle_initial, p.suffix,
p.date_of_birth,p.gender
from member_work_item mwi, work_item wi,
account_relationship ar,
person p, person_eligibility_attrs pea
where wi.work_item_id = mwi.work_item_id
and p.party_id = pea.party_id
and mwi.account_relationship_id = ar.account_relationship_id
and ar.party_id = p.party_id
and pea.mdcd_match_status is null
and wi.status = 'UNRESOLVED'
and (length(p.first_name) > 15
or length(p.last_name) > 20
or length(p.member_id) > 8
or length(p.ssn) > 8
or length(p.gender) > 1
or length(p.suffix) > 4
or length(p.middle_initial) > 1);
OUTPUT:
PARTY_ID MDCD_MATCH_STATUS MEMBER_ID FIRST_NAME LAST_NAME M SUFFIX DATE_OF_BIR G
---------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ---------------------------------------- ---------------------------------------- - ---------- ----------- --------- -
3156624 15278332 TAYLOR HUGGINS D 26-MAY-1999 F
2486336 152795 MICHAEL MILLS M 16-SEP-1995 M
2000204 176931 JIMMY THOMAS L JR 13-SEP-1994 M
But I should get the OUTPUT as shown in below:
PARTY_ID MEMBER_ID FIRST_NAME LAST_NAME MID SUFFIX DATE_OF_BIRTH GEN
___________________________________________________________________________________________________________
4179194 110024065Z KEREN GIRON E Hija 09-JAN-08 F
4179518 110024418Z BRYCE TAYLOR R Master 24-OCT-07 M
4178982 110023810Z GRACEY NEWMAN L granddaugh 28-APR-03 F
4178981 110023811Z MERCEDES NEWMAN M grdaughter 13-MAY-04 F
4178979 110023809Z CHRISTOPHER NEWMAN JR. I grandson 24-APR-00 M
Please some one help me how can i get the sql ouput like shown above.
Thanks in Advance!