utl_file has execute granted to public -0 so there is no need to grant
execute.

Alex Hillman

-----Original Message-----
Sent: Wednesday, August 29, 2001 2:57 PM
To: Multiple recipients of list ORACLE-L
stored


Do not forget 'grant execute on utl_file to apps_user' before running..

MOHAMMAD RAFIQ

Reply-To: [EMAIL PROTECTED]
To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
Date: Wed, 29 Aug 2001 08:21:20 -0800


Ranganath,

First you have to specify a place where Oracle may write the file.  You do
this by setting the UTL_DIR parameter in your init<SID>.ora file.  Make
sure that the Oracle user has write permission on the directory(ies) you
specify.  You'll need to bounce the DB to have this parameter take effect.

Your code will look something like this(this is for an NT Box):

CREATE or REPLACE .........
AS
   CURSOR XXX IS......

         vocstu_report             utl_file.file_type;

BEGIN

         vocstu_report:= utl_file.fopen('F:
\oracle\admin\reports','vocstu_report.txt','W');

(All your processing here)

                        utl_file.put_line(vocstu_report,
                                         RPAD(v_lastname,25,' ') ||
                                         RPAD(v_firstname,15,' ') ||
                                         RPAD(v_gender,6,' ') ||
                                         RPAD(v_grade,5,' ') ||
                                         RPAD(v_ethniccode,6,' ') ||
                                         RPAD(v_altid1,13,' ') ||
                                         RPAD(v_AGATInd,5,' ') ||
                                         RPAD(v_STXPInd,4,' '));


David A. Barbour
Oracle DBA, OCP
AISD
512-414-1002



                     "Ranganath K"
                     <ranganathk@subex       To:     Multiple recipients of 
list ORACLE-L <[EMAIL PROTECTED]>
                     group.com>              cc:
                     Sent by:                Subject:     Spooling output of

a select statement to a file through
                     [EMAIL PROTECTED]         stored procedure


                     08/29/2001 06:00
                     AM
                     Please respond to
                     ORACLE-L






Dear DBA Gurus,

            How do I spool output of a select statement to a file through
stored
procedure.  The stored procedure should take the directory and path of the
file to be spooled to on the client machine.  I know we can do this using
UTL_FILE package.  But I don't want to write to a file in Oracle Database
server machine rather I want to write the output to a file in client
machine.  Please note that I want to do this through a Pl/Sql procedure or
a
pl/sql program so that the procedure can be called from the front end which
is Java/C++.   How do I do this?  Any help in this regard will be duly
appreciated.

Thanks and Regards,

Ranganath


DISCLAIMER: This correspondence is confidential and intended for the named
recipient(s) only. If you are not the named recipient and receive this
correspondence in error, you must not copy, distribute or take any action
in
reliance on it and you should delete it from your system and notify the
sender immediately. Unless otherwise stated, any views or opinions
expressed
are solely those of the author and do not represent those of Subex Systems
Limited.

www.subexgroup.com


--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Ranganath K
   INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
   INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Mohammad Rafiq
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Hillman, Alex
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to