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: Shel Script

Re: Shel Script

From: terryg8 <trg_at_ibm.net>
Date: 1997/07/15
Message-ID: <33CC2C3D.1C93@ibm.net>#1/1

RISHI ANAND wrote:
>
> Hello All,
>
> Just had a question, as to how could we write a shell script in UNIX, if
> I wanted to execute SQL commands by simply running them within the shell
> script? (It could be any shell, c, korn,...etc..) I tried using the
> script with "sqlplus/ but it just gets stuck at the sqlplus prompt and
> waits for me to input some SQL commands....I think I must be missing
> something....any idea...?
>
> Please let me know..
>
> Thanks in advance.
>
> --
> --Rishi
>
> ## Never let your sense of morals prevent you from doing what is right. ##
>
> -- Salvor Hardin, "Foundation".

Try an "inline document" (that might be an old term but it shold work). Basically, within the script you indicate that the sqlplus program gets its input from the script itself until it reachs a marker.

i.e.
sqlplus uid/pwd <<EOF
 select something
 etc
 etc
 exit
EOF SQLPLUS runs using anything between the EOF's as input just as if it had been typed interactively. You can use variables to hide the userid and password etc.

Cheers,
Terry Received on Tue Jul 15 1997 - 00:00:00 CDT

Original text of this message

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