Re: Write PL/SQL query results to a file

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 18 Jun 2003 14:58:51 -0700
Message-ID: <92eeeff0.0306181358.7af9bbb6_at_posting.google.com>


shhmoo_at_excite.com (robert) wrote in message news:<114e40a3.0306180716.5aa0b4b8_at_posting.google.com>...
> I'm trying to write the results of my PL/SQL query to a file. I have
> came across a number of possible* solutions such as DBMS_PIPE and
> UTL_FILE. Basically, I am running a batch file on an NT box and would
> like to obtain the results from the DB server running Oracle
> 8.1.7.4.0.
>
> So far I have been able to get export a file to my local machine by
> doing:
> exp 'usr/passwd _at_db' full=no file=%ORACLE_SID%.dmp %ORACLE_SID%.log
>
> I would like to have this file be the output of my query instead. Any
> info appreciated. Thanks in advance.

exp tool is used to EXPort contents of an Oracle database and is used in conjunction with imp tool to IMPort contents of the dump file to a database. What you want to do can done by either UTL_FILE package (This will create a file on the database server so you would have to ftp/copy the file to your machine) or if just running a script from sqlplus, use SPOOL to spool resultset to a file anywhere on your machine or network drive.

Regards
/Rauf Sarwar Received on Wed Jun 18 2003 - 23:58:51 CEST

Original text of this message