v_a varchar2(100);定义一个变量
v_b varchar2(100);
select a into v_a, b into v_b from table; 将sql 中查出的值付给 变量 v_a,v_b
select * from table2 where id=v_a; 在另一个sql中使用被付过值的变量
create procedure sp_test
as
declare @a varchar(10)
declare @b varchar(10)
set @a=(select colA from test)
set @b=(select colB from test)
select * from testtable where colC = @a and colD = @b