Calling sql in shell script with parameters

Dear All,

I want to call an sql script within a unix shell script. I want to pass a parameter into the shell script which should be used as a parameter in teh sql script.

e.g

$ ./shell1.sh 5000129

here 5000129 is a prameter

inside shell script i am calling one sql script
e.g.
@script1.sql;

inside the sql script I have an update statement

UPDATE abc set xx = 22 where id = 500129;

as you can see the 5000129 passed as shell script parameter, is being passed as parameter in the sql script.

Please can you advise how can I achieve this?

Many Thanks,

In your script :

sqlplus ... <<!

@script1.sql $1

!

script1.sql

UPDATE abc set xx = 22 where id = &1;

Jean-Pierre.

In the shell script you can call the sql script as follow with the first parameter:

@script1.sql $1

In your sql script, your substitution variable will be &1 for the first argument:

UPDATE abc set xx = 22 where id = &1;

Regards