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
Solved

PL/SQL SQL Plus DBMS Output question

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
data lookup in Oracle - need suggestions 55 121
join 2 views with 5 conditions 3 61
run sql script from putty 4 63
PL/SQL: ORA-00979: not a GROUP BY expression 3 27
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

808 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