用动态SQL语句
将结果插入表temp
create table temp(hh varchar2);
create or replace procedure proc_example(条件类型 NUMBER,条件值 VARCHAR2) AS
sql_str varchar2(2000);
str varchar2(100);
begin
if 条件类型=1 then str:='rq';
else
str:='area';
end if;
sql_str:='insert into temp select bh from tbl_a where '||str||'='||条件值||
'select bh from tbl_b where '||str||'='||条件值||;
commit;
end
将结果插入表temp
create table temp(hh varchar2);
create or replace procedure proc_example(条件类型 NUMBER,条件值 VARCHAR2) AS
sql_str varchar2(2000);
str varchar2(100);
begin
if 条件类型=1 then str:='rq';
else
str:='area';
end if;
sql_str:='insert into temp select bh from tbl_a where '||str||'='||条件值||
'select bh from tbl_b where '||str||'='||条件值||;
commit;
end
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货