Solved

PL/SQL SQL Plus DBMS Output question

Posted on 2004-04-29
4
5,853 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

777 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