Re: HELP: Output from within Stored Procedure???

From: Scott Urman <surman_at_oracle.com>
Date: 1996/05/07
Message-ID: <4modts$8pm_at_inet-nntp-gw-1.us.oracle.com>#1/1


In article <4mo7nn$k6h_at_netline-fddi.jpl.nasa.gov>, kchildre_at_uccs.jpl.nasa.gov (Ken Childress) writes:
|> In article <4mo42f$j0o_at_netline-fddi.jpl.nasa.gov>,
|> Ken Childress <kchildre_at_uccs.jpl.nasa.gov> wrote:
|> >I apologize in advance if this question is addressed in a FAQ somewhere.
|> >I am an Oracle newbie and under a deadline, so I need to find an answer
|> >as quickly as possible.
|> >
|> >I am trying to write some stored procedures to do various queries and
|> >output the results, via STDOUT, so they can be parsed by a PERL script.
|> >
|> >I want to do something similar to the following:
|> >
|> >create procedure display_user (social_security_no char) as
|> > user_rec user_accounts%rowtype;
|> >begin
|> > select * into user_rec from user_accounts where ssn = social_security_no ;
|> > printf ("User Name = %s\n", user_rec.user_name);
|> > printf ("SSN = %s\n", user_rec.ssn);
|> > ...
|> >end;
|> >
|> >
|> >The problem is, I can't find the any statements in SQLPLUS that will
|> >allow me to output to to STDOUT. I can use SQL queries invoked via
|> >shell scripts that do the select, but in our application many queries
|> >are needed and it is quite slow that way.
|> >
|> >Any suggestions?
|>
|> Further poking around has allowed me to answer my question. For those
|> interested in the answer, the package DBMS_OUTPUT contains the
|> procedures needed to accomplish the task.
|>
|> I don't know where that package is documented, but I found an example in
|> the code from the book _Oracle PL/SQL Programming_ that is downloadable
|> from http://www.osborne.com/oracle/ora12.htm.

The DBMS_OUTPUT package is documented in several places:

- the package itself: look in $ORACLE_HOME/rdbms/admin/dbmsotpt.sql
- the Oracle7 Application Developer's Guide
- and last but not least, Chapter 8 of _Oracle PL/SQL Programming_ :)

|>
|> Ken
|>
|>
 

-- 
------------------------------------------------------------------------
Scott Urman            Oracle Corporation           surman_at_us.oracle.com
------------------------------------------------------------------------
Author of "Oracle PL/SQL Programming", ISBN 0-07-882176-2
Published by Oracle Press - http://www.osborne.com/oracle/index.htm
------------------------------------------------------------------------
"The opinions expressed here are my own, and are not necessarily that of
 Oracle Corporation"
------------------------------------------------------------------------
Received on Tue May 07 1996 - 00:00:00 CEST

Original text of this message