Thanks for the question, Swapnil.
Asked: November 07, 2012 - 4:55 am UTC
Last updated: November 07, 2012 - 12:12 pm UTC
Version: 11g R2
Viewed 1000+ times
You Asked
I have a piece of code in which I am trying to connect using a dynamic connection string
DEFINE Schema=&1 --Schema name is passed from a shell script
VARIABLE v_conn varchar2(100)
VARIABLE v_pass varchar2(100)
VARIABLE v_service varchar2(100)
begin
v_conn := lode.f_get_password('&Schema.');
v_pass := substr(:v_conn,1,instr(:v_conn,'@')-1);
v_service := substr(:v_conn,instr(:v_conn,'@')+1);
end;
/
conn &Schema./:v_conn@:v_service
show user;
exit
When I am trying to use connect it is not able to read the values of v_conn and v_service.
Can you please help me here?
and Tom said...
just add:
column conn new_val C
column service new_val S
select :v_conn conn, :v_service service from dual;
right before you connect and use &C and &S for connection and service.
Is this answer out of date? If it is, please let us know via a Comment