Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Output in SQL Worksheet or SQLPlus

Re: Output in SQL Worksheet or SQLPlus

From: Dogan Cibiceli <dcib_at_gwl.com>
Date: Fri, 20 Aug 1999 20:01:17 -0600
Message-ID: <37BE086D.4D80EAEE@gwl.com>


hi there,
  I wouldnot recommend SQL*Plus if you are working with PL/SQL. Try procedure builder or one of the free tools. Also the way you print is something like that. Assuming you are in sql*+.

set serveroutput on -- so that you will see output of dbms_output package declare
  cursor c1 is
  select *
  from employee ;
  emp_num number := 0 ;
begin
  dbms_output.enable(1000000) ; -- get the largest buffer we can for displaying....
  for c1rec in c1 loop -- notice you donot declare c1rec

     emp_num := c1rec.emp_num ; -- use rec as if u r referring to the fields of the table ;

     /* Do lot of stuff */
    dbms_output.put('Emp #' || emp_num) ; -- like printf without newline     dbms_output.put_line('Other stuff' || other_stuff) ; -- printf with newline printed at the end
  end loop ; -- look up cursor for loops end ;
/
I have not used any exceptions if need to declare and use them but I think this should be enough...

Dogan

Tom Williamson wrote:

> Please pardon this newbie question, but what's the best way to display
> output in SQL Worksheet or SQL Plus, when using PL/SQL?
>
> In MS-SQL Server it would be simple - either simply SELECT * FROM TABLE or
> else PRINT the values you want.
>
> In Oracle, SELECT X FROM TABLENAME results in an error stating "an INTO
> clause is expected", and there doesn't seem to be a PRINT or ECHO statement
> anywhere (at least I can't find it.) What's everyone's favorite way of
> doing this (getting output onto the screen)?
>
> Thanks - Tom
Received on Fri Aug 20 1999 - 21:01:17 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US