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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Unix shell script drops chars sent to sqlplus - here document, etc.

Re: Unix shell script drops chars sent to sqlplus - here document, etc.

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: Tue, 04 Mar 2003 15:17:24 +0000
Message-ID: <b4296b$5dn$1@ctb-nnrp2.saix.net>


CBarr wrote:

> Does anyone know why this would happen?
<snipped>

The problem I think is mixing and matching characters in attempt to make the complete script fit into the print commands double quotes.

Rather do this instead. Many times simpler and you do not require to enclose the embedded scipt's contents with quotes.

--
#!/bin/sh

# variables
spoolFile=$spoolDir/drillProdTemp.lst 

# run SQL script by redirecting STDIN
sqlplus << EOF
${L_USER_NAME}/${pw}

SET echo on;
SET termout on;
SPOOL ${spoolFile};

CREATE TABLE drill_prod_temp 
AS 
SELECT prod.surr,
 .. insert rest of your script here ..

SPOOL off;
EXIT;

EOF
--

If you want to supress all output from SQL*Plus, just wanting to have the 
spool file, you can replace this:
sqlplus << EOF
with this:
sqlplus 1>/dev/null 2>/dev/null << EOF



--
Billy
Received on Tue Mar 04 2003 - 09:17:24 CST

Original text of this message

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