want to display fields using dbms_output.put_line [message #379390] |
Tue, 06 January 2009 05:26  |
radhavijaym
Messages: 65 Registered: December 2008 Location: singapore
|
Member |
|
|
hi,
i created a procedure
i printing values from a table trough dbms_output.put_line
i want my output to be in this format
custname number partyname
abc 123 ABC
pqr 345 qww
drr 444 ooo
ppp 999 iii
...
i wnat my output to this format
i want header (custname,number,party name ) to display only once .
i m getting output like this
custname number partyname
abc 132 abc
custname number partyname
wewqrwqrewrre 213214 hrioweyro
custname number partyname
wutytrywetre 24325545 lkkewf
im getting like this idont want like this
so please help me how to do this
-
Attachment: Docbnb.pdf
(Size: 357.90KB, Downloaded 1151 times)
[Updated on: Tue, 06 January 2009 05:29] Report message to a moderator
|
|
|
Re: want to display fields using dbms_output.put_line [message #379392 is a reply to message #379390] |
Tue, 06 January 2009 05:30   |
S.Rajaram
Messages: 1027 Registered: October 2006 Location: United Kingdom
|
Senior Member |
|
|
Unfortunately my crystal ball is broken . So I am unable to see the code you are executing. If you don't mind could you post the actual code along with the output and the expected output required. Also please follow the forum guidelines on how to format your post.
Regards
Raj
[Edit: ] If you don't mind could you post it inline rather an attachment.
[Updated on: Tue, 06 January 2009 05:31] Report message to a moderator
|
|
|
|
Re: want to display fields using dbms_output.put_line [message #379504 is a reply to message #379392] |
Tue, 06 January 2009 18:31  |
 |
Barbara Boehmer
Messages: 9106 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
Peering into my crystal ball, I see a procedure with a loop and a dbms_output.put_line that displays the column headings within the loop. Move that line outside the loop, as in the example below.
SCOTT@orcl_11g> CREATE OR REPLACE PROCEDURE demo_proc
2 AS
3 BEGIN
4 DBMS_OUTPUT.PUT_LINE ('DEPTNO DNAME LOC'); -- HEADINGS HERE
5 FOR r IN (SELECT deptno, dname, loc FROM dept)
6 LOOP
7 -- NO HEADINGS HERE
8 DBMS_OUTPUT.PUT_LINE
9 (RPAD (r.deptno, 7) ||
10 RPAD (r.dname, 15) ||
11 RPAD (r.loc, 14));
12 END LOOP;
13 END;
14 /
Procedure created.
SCOTT@orcl_11g> SET SERVEROUTPUT ON
SCOTT@orcl_11g> EXEC demo_proc
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
PL/SQL procedure successfully completed.
SCOTT@orcl_11g>
|
|
|