Solved

PL/SQL SQL Plus DBMS Output question

Posted on 2004-04-29
4
5,845 Views
Last Modified: 2012-06-21
I have working code but having trouble displaying it the way i need it in SQL Plus v9.2.  I need every other line to be indented approx 8 spaces.

Here's the code:

declare

v_lname dcs_consultant.c_lname%type;
v_fname dcs_consultant.c_fname%type;
v_skill_id  dcs_consultant_skill.skill_id%type;

cursor consultant_cursor is
  select c_lname, c_fname, count(skill_id)
  from dcs_consultant natural join dcs_consultant_skill
  group by c_lname, c_fname
  order by c_lname, c_fname;

begin

open consultant_cursor;
loop
  fetch consultant_cursor into v_lname, v_fname, v_skill_id;
  exit when consultant_cursor%notfound;
  dbms_output.put_line (v_lname|| ' ' ||v_fname);
  dbms_output.put_line ('        Number of skills:  '||v_skill_id);
end loop;
close consultant_cursor;

end;
-----------------------------------------------------
Here's the output I get:

Camel Joe
Number of skills:  1
Crunch Capn
Number of skills:  3
Doe Jane
Number of skills:  2
Ellison Larry
Number of skills:  4

PL/SQL procedure successfully completed.
-----------------------------------------------------

Here's the output I need:

Camel Joe
        Number of skills:  1
Crunch Capn
        Number of skills:  3
Doe Jane
        Number of skills:  2
Ellison Larry
        Number of skills:  4
0
Comment
Question by:dcs001
4 Comments
 
LVL 10

Accepted Solution

by:
SDutta earned 125 total points
ID: 10953816
You can do this before your procedure

SQL> set serveroutput on format wrap
SQL> begin
  2  dbms_output.put_line ('        TESTING');
  3  end;
  4  /
        TESTING                                  

PL/SQL procedure successfully completed.\

0
 
LVL 23

Expert Comment

by:seazodiac
ID: 10954755
If my memory serves me right, it should be "WRAPPED" , not WRAP

try this before your plsql procedure;

SQL>set serveroutput on format wrapped;

0
 
LVL 8

Expert Comment

by:annamalai77
ID: 10955827
hi there

u query should work. check whether u have recompiled ur procedure after u have some modifications.

otherwise replace the dbms line with this method

dbms_output.put_line ('        ' || 'Number of skills:  '||v_skill_id);

that should work

regards
annamalai


0
 
LVL 12

Expert Comment

by:catchmeifuwant
ID: 10956060
Or why not use a TAB delimiter ?

dbms_output.put_line (chr(9)||'Number of skills:  '||v_skill_id);
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now