Home » Infrastructure » Unix » passing argument from unix 2 sql in silent mode
passing argument from unix 2 sql in silent mode [message #97250] Mon, 04 February 2002 07:00 Go to next message
balwinder
Messages: 2
Registered: February 2002
Junior Member
How to pass an argument from command prompt in unix OS to a select query running in silent mode.
Re: passing argument from unix 2 sql in silent mode [message #97252 is a reply to message #97250] Mon, 04 February 2002 17:40 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Once you have the unix variable populated into say MY_VAR1, pass it to the sql script from the unix script as follws:
sqlplus -s user/pass @my_script.sql $MY_VAR1

in you sql script, catch it into &1. e.g.

my_script.sql
=============
set verify off
select * from cat where table_name = '&1';
Previous Topic: SQL in Unix Script Example
Next Topic: Unix Install - ORACLE_HOME environment variable error
Goto Forum:
  


Current Time: Thu Mar 28 08:43:17 CDT 2024