Link to home
Start Free TrialLog in
Avatar of jl66
jl66Flag for United States of America

asked on

How to assign ORACLE_SID to variable in sqlplus

Would like to have the following under sql plus prompt:

1) It worked  
>@test.sql ORACLE_SID
where in test.sql, I can put
define ORACLE_SID=&1
...
I do not want this.

2) Since once logging in database, the ORACLE_SID can be obtained from
select name from v$database;

Is there any way to assign the SID into a define statement in sqlplus?
For example,

>@test.sql
...
define ORACLE_SID = ...
--get the SID via whatever.
...
use the SID in other sql statements.
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jl66

ASKER

Exactly what I need. Thank you so much.