Solved

PL/SQL SQL Plus DBMS Output question

Posted on 2004-04-29
4
5,836 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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.

Join & Write a Comment

Suggested Solutions

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…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

772 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

10 Experts available now in Live!

Get 1:1 Help Now