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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: TEXT FILE

RE: TEXT FILE

From: Stephen Lee <Stephen.Lee_at_DTAG.Com>
Date: Thu, 19 Jun 2003 15:26:18 -0700
Message-ID: <F001.005B5B0D.20030619151009@fatcity.com>

A somewhat messy way to do this, if you are on Unix, is a shell script something like:

export ORACLE_SID=BUBBA
export ORALCE_HOME=/dir/dir/product/9.2.0 export PATH=$ORACLE_HOME/bin:${PATH:-/usr/bin:/usr/sbin:/whatever/else}

... anything else I forgot ...

cat /dev/null > my_text_file

{
sqlplus -s <<-XXX
username/[EMAIL PROTECTED]
set lines 300 pages 0 trims on heading off feedback off set whatever else
select this,that,the,other,thing from my_big_table; XXX
} | /usr/bin/sed '/^$/d' | while read LINE; do

        echo "$LINE" >> my_text_file
done

exit 0

--------- snip -------------------

Note: The sed statement deletes blank lines, so it is probably not required but is there as an example.
You aren't required to use the while read LINE stuff. You can take it out and run the script as:

./my_script > my_text_file

If you are on MS-DOS, I think you can put the sqlplus commands in a file called, for example, sql_plus_commands, then do something like:

sqlplus -s < sql_plus_commands > my_text_file

This will work on Unix too; but it's not as cool as the self-contained shell script. And we all want to be as cool as possible.
--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Stephen Lee
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
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). Received on Thu Jun 19 2003 - 17:26:18 CDT

Original text of this message

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