Display results in Table format instead of dbms_output.put_line [message #130028] |
Wed, 27 July 2005 14:49  |
nvillare
Messages: 11 Registered: July 2005
|
Junior Member |
|
|
I have a declare sql script that contains 2 cursors. Depending on the day, ie, Monday, Sunday, etc. it will loop through one of the cursors. Currently I have it to show the data as dbms_output.put_line but the data isn't lined up. Is there any way to have the data appear in a table format?
This is what I currently have that is shows it on dbms_output.put_line.
SET SERVEROUT ON SIZE 100000
DECLARE
v_date varchar2(25);
Cursor C1 IS
select a.attribute9||'-'||a.segment1 "PO_NUM", a.revision_num "REV_NUM", to_char(a.approved_date,'MM/DD/YYYY') "APP_DATE"
from tableToCall a
where a.authorization_status = 'APPROVED'
and trunc(approved_date) between (trunc(sysdate) - 4) and (trunc(sysdate) - 1)
and a.org_id != 159
order by org_id, 1;
Cursor C2 IS
select a.attribute9||'-'||a.segment1 "PO_NUM", a.revision_num "REV_NUM", to_char(a.approved_date,'MM/DD/YYYY') "APP_DATE"
from tableToCall a
where a.authorization_status = 'APPROVED'
and trunc(approved_date) = (trunc(sysdate) - 1)
and a.org_id != 159
order by org_id, 1;
BEGIN
select to_char(sysdate,'Day')
into v_date
from dual;
dbms_output.put_line(chr(10) || v_date || chr(10));
begin
if v_date = 'Monday' then
for R in C1 LOOP
dbms_output.put_line('PO Number: ' || R.PO_NUM || chr(9) || 'Revision Num:' || R.REV_NUM || chr(9) || 'Approved Date: ' || R.APP_DATE);
END LOOP;
elsif v_date != 'Saturday' OR v_date != 'Sunday' OR v_date != 'Monday' then
for R in C2 loop
dbms_output.put_line('PO Number: ' || R.PO_NUM || chr(9) || 'Revision Num:' || R.REV_NUM || chr(9) || 'Approved Date: ' || R.APP_DATE);
end loop;
end if;
end;
END;
/
Any help is greatly approeciated.
Thanks,
|
|
|
|
|
|