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-Oracle script interface help

Re: UNIX-Oracle script interface help

From: Chuck Hamilton <chuckh_at_safeaccess.net>
Date: 1998/12/11
Message-ID: <36712cca.4716117@news1.axs2000.net>#1/1

The ! mark for terminating a "here document" is perfectly acceptable. It's what I use in nearly every case. I don't see anything wrong with your script. I even copied it to a file on my HP system and tried it. I had to change the logname and password obviously, and I also changed the SQL to "select count(*) from dba_users;". It worked find.

Two questions:

  1. Are there any control characters that are in the script but didn't make it into the email?
  2. Are you piping the output of this script into another sqlplus session? If so, that would explain it treating TEST as a command.

        Chuck

On Tue, 08 Dec 1998 22:11:13 GMT, sybaseuser_at_hotmail.com wrote:

>Hi,
>
>Please excuse my email handle and help me with this Unix/Oracle shell script
>(Korn) problem:
>
>In my shell script I have:
>
>
>#!/bin/ksh
>
>LOGNAME=testid
>PASSWORD=testpw
>SPOOL_FILE=./test.log
>
>sqlplus -s $LOGNAME/$PASSWORD <<!
>spool $SPOOL_FILE
>set heading off
>set linesize 300
>
>select 'E1', a.sls_org_cd, a.dist_chnl_cd,
> a.doc_crncy_cd, a.cust_grp_cd, a.matl_cd,
> b.matl_nm
>from table_a a, table_b b
>where a.matl_id = b.matl_id;
>
>spool off
>!
>
>echo "TEST"
>
>
>Somehow the last line: echo "TEST" is being treated as a Oracle command and
>fed into Oracle and I got the following message in my output:
>
>unknown command beginning "echo "TEST"" - rest of line ignored.
>For a list of known commands enter HELP and to leave enter EXIT.
>
>I though the ! sign was sufficient to tell Oracle to exit the SQLPlus session
>(this is how it is done in Sybase). If I put "exit" before the ! sign then
>the entire UNIX script exits right there and the echo "TEST" statement
>doesn't get executed at all.
>
>Any help will be appreciated.
>
>Thanks
>
>Calvin L.
>sybaseuser_at_hotmail.com
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

--
Chuck Hamilton
chuckh_at_safeaccess.net

"Therefore the Lord Himself will give you a sign:
Behold, a virgin will be with child, and bear a son,
and she will call His name Immanuel." (Isa 7:14 NASB)
Received on Fri Dec 11 1998 - 00:00:00 CST

Original text of this message

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