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: PASSING A PARAMETER FROM KORN SHELL (NEWBIE)

Re: PASSING A PARAMETER FROM KORN SHELL (NEWBIE)

From: <kroutchef_at_my-dejanews.com>
Date: Thu, 11 Mar 1999 19:54:26 GMT
Message-ID: <7c971c$jl0$1@nnrp1.dejanews.com>


Hello,

If you really want to include sqlplus call from inside of a Ksh Script just try this :

#:!/usr/ksh
export $STFIPS=35

sqlplus -s users/password <<! 1>log_file

   select * from dummy
   where dummy_id = $STFIPS;
!

Any Sql Script can be run this way, i personnaly use this to execute anonymous PL/SQL Block as follow :

#!/bin/ksh
export My_PROG=$1

sqlplus -s user/password <<! 1>log_file

   declare
    nError Number;
  begin
    $MY_PROG ( NError );
    DBMA_OUTPUT.PUT_LINE(' Error : '|- nError);   end;
  /
!

When you run a script the folowing way : sqlplus user/password @my_script.sql

The script should contain an EXIT at his very end if you want to automatic log off from sqlplus, you dont need it using the folowing :

sqlplus -s user/password <<! 1>log_file

   @my_script
!

Pascal

In article <7c8sb7$9c3$1_at_nnrp1.dejanews.com>,   cary_at_nams.net wrote:
> Hello,
>
> If you have your SELECT statement in a .sql script, you can issue the
> following:
>
> sqlplus user/passwd_at_alias @script.sql $STFIPS
>
> Then, in your script.sql the parameter &1 will be assigned the value of
> $STFIPS and can be used in the WHERE clause. I hope this helps.
>
> Cary
>
> In article <36E7132B.4386F845_at_worldnet.att.net>,
> j.gober_at_worldnet.nospam.att.net wrote:
> > This is a multi-part message in MIME format.
> > --------------00067491095A877E265ABD30
> > Content-Type: text/plain; charset=us-ascii
> > Content-Transfer-Encoding: 7bit
> >
> > To the great Oracle of Oracle:
> >
> > I have the need to pass a UNIX logical parameter called STFIPS (example:
> > STFIPS=35) which is identified in a Korn shell into a where clause in an
> > SQL. The answer has to be simple but not to us newbies who have never
> > done it before.
> >
> > All help is appreciated
> >
> > John 'the newbie' Gober
> >
> > --------------00067491095A877E265ABD30
> > Content-Type: text/x-vcard; charset=us-ascii;
> > name="j.gober.vcf"
> > Content-Transfer-Encoding: 7bit
> > Content-Description: Card for John Charles Gober
> > Content-Disposition: attachment;
> > filename="j.gober.vcf"
> >
> > begin:vcard
> > n:Gober;John Charles
> > x-mozilla-html:TRUE
> > adr:;;8105 Carlyle Place;Alexandria;VA;22308;USA
> > version:2.1
> > email;internet:j.gober_at_worldnet.att.net
> > x-mozilla-cpt:;0
> > tel;work:301-457-3830
> > fn:John Charles Gober
> > end:vcard
> >
> > --------------00067491095A877E265ABD30--
> >
> >
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Thu Mar 11 1999 - 13:54:26 CST

Original text of this message

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