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: Use shell script parameter in sql script?!

Re: Use shell script parameter in sql script?!

From: Kenneth C Stahl <BlueSax_at_Unforgettable.com>
Date: Tue, 14 Sep 1999 13:47:22 -0400
Message-ID: <37DE8A2A.EB24601E@Unforgettable.com>


Not sure what you mean. It isn't escaped. The $1 is in double quotes because it is passed as a string rather than as a number. Since the column in emp is numberic, however, an implicit conversion is performed by oracle before the where clause is evaluated.

Jim Tench wrote:

> Not sure you really wanted to escape the $1 in that example....
>
> Jim
>
> Kenneth C Stahl <BlueSax_at_Unforgettable.com> wrote in message
> news:37DE351F.45AB49AB_at_Unforgettable.com...
> > Mario Bucsics wrote:
> >
> > > No, but if you pass parameters to the shell script you can
> > > use the &1 &2 &3 ... in your sql script.
> > >
> > > Mario Bucsics
> > >
> > > * Sent from RemarQ http://www.remarq.com The Internet's Discussion
> Network *
> > > The fastest and easiest way to search and participate in Usenet - Free!
> >
> > Of course shell variables can be used. Try this:
> >
> > #!/bin/ksh
> > sqlplus -s scott/tiger <<-sqlEOF
> > set pages 0;
> > set feedback off;
> > select *
> > from emp
> > where empno = '$1';
> > exit success;
> > sqlEOF
> > exit 0;
> >
> >
> >
Received on Tue Sep 14 1999 - 12:47:22 CDT

Original text of this message

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