Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Bind/Substitution variable

user10647455Aug 17 2011 — edited Aug 18 2011
Hello
I have a series of select statments and i am writing its output to a file, these sql statments required a 3 substitution variable and i am deriving those variables from some tables.

something like this
my sql file
var my_var1 varchar2(15)
var my_var2 varchar2(15)
var my_var3 varchar2(15)
begin
select  v1,v2,v3 into
   :my_var1, :my_var2, :my_var3 from some_table;
end;

spool my_location

select some_value
from my_table 
where my = &my_var1;

select some_value2
from my_table2
where my2 = &my_var2;
.......
.........
and so on.....
almost 15-16 sql statments...

I know this will not work is there any other way of assigning value from bind variable to my subs variable ...
1 constraint i have is i need the sql output of only select statments

Please help...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 15 2011
Added on Aug 17 2011
12 comments
471 views