Solved

PL/SQL SQL Plus DBMS Output question

Posted on 2004-04-29
4
5,870 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
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…
Suggested Courses

617 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