有以下语句:
select
(select * from 表1 where 字段1=(select * from 表2 where 字段2='01') and 字段3='高级') a,
(select * from 表1 where 字段1=(select * from 表2 where 字段2='01') and 字段3='中级') b,
(select * from 表1 where 字段1=(select * from 表2 where 字段2='01') and 字段3='初级') c
from dual能否用什么变量之类的来代替 (select * from 表2 where 字段2='01') 或者 变量= (select * from 表2 where 字段2='01')
即写成
select
(select * from 表1 where 字段1=变量 and 字段3='高级') a,
(select * from 表1 where 字段1=变量 and 字段3='中级') b,
(select * from 表1 where 字段1=变量 and 字段3='初级') c
from dual具体怎么写,我不大懂这些的语法
select
(select * from 表1 where 字段1=(select * from 表2 where 字段2='01') and 字段3='高级') a,
(select * from 表1 where 字段1=(select * from 表2 where 字段2='01') and 字段3='中级') b,
(select * from 表1 where 字段1=(select * from 表2 where 字段2='01') and 字段3='初级') c
from dual能否用什么变量之类的来代替 (select * from 表2 where 字段2='01') 或者 变量= (select * from 表2 where 字段2='01')
即写成
select
(select * from 表1 where 字段1=变量 and 字段3='高级') a,
(select * from 表1 where 字段1=变量 and 字段3='中级') b,
(select * from 表1 where 字段1=变量 and 字段3='初级') c
from dual具体怎么写,我不大懂这些的语法
create procedure pro_name
is
a varchar2(100);
b varchar2(100);
c varchar2(100);
begin
a := '(select * from 表1 where 字段1=(select * from 表2 where 字段2='01') and 字段3='高级')';
b :='(select * from 表1 where 字段1=(select * from 表2 where 字段2='01') and 字段3='中级')';
c :='(select * from 表1 where 字段1=(select * from 表2 where 字段2='01') and 字段3='初级级')';execute immediate a;
end;