开发者

passing parameters from unix to pl sql

I have a dumb problem. From a ksh I'm connecting to sql plus to execute some query. I want to pass 2 parameters from unix to pl sql. I found some stuff but it does not works.

UNIX:

sqlplus -L $ORA_CONNECT @"$FIC_REQ" $1 $2

PLSQL:

   DECLARE

     param1 := $1;
     param2 := $2;
BEGIN

 SELECT * from MYTABLE where field1=param1 and field2=param2;

END

Any idea how to do it ?


Actually, I got it.

I must use a double dollar in plsql, lik开发者_如何转开发e

param1:=$$1 param2:=$$2


I think you need to use %1 and %2, not the $ (dollar) symbol.


sqlplus -L $ORA_CONNECT @"$FIC_REQ" param1 param2

BEGIN

SELECT * from MYTABLE where field1=&1 and field2=&2;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜