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: Spooling in PL/SQL

Re: Spooling in PL/SQL

From: <pobox002_at_bebub.com>
Date: 23 Mar 2005 18:02:25 -0800
Message-ID: <1111627863.755988.307170@f14g2000cwb.googlegroups.com>


iceriver wrote:
> Hi All,
>
> 1) I want to write a procedure which is able to spool all the select
> statement into a text file.
>
> eg. the result I want in the spool file:
> select * from customer where customer_id=xx;
> select * from order where customer_id=xx;
> select * from product where product_id=yy;
>
> The procedure should allows me to put the xx and yy value when i
> execute the procedure. I heard it's impossible to do unless using ref
> cursor?

It is not impossible, although using a ref cursor and the spool command in sqlplus would be the simplest, most flexible and efficient method.

> Someone has suggested it can done thru UTL_FILE. What you guys
> opinions?

It can if you want to write more code, have it run slower, and only be able to write to the server.

>
> 2) If I only want the the procedure to display results on the screen
> (no spooling), how I can achieve that?

Depends which method you use to implement it. If you use the spool command you simply would not issue it.

-- 
MJB
Received on Wed Mar 23 2005 - 20:02:25 CST

Original text of this message

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