刚开始写存储过程,遇到一个比较大的问题。
如下:
test(strWhere varchar2) is
begin
insert into table1 select id from table2 where strWhere;
commit;
end;
不可用,说是sql语句出现错误。
我使用这个存储过程的原因是可以根据自己拼where条件,把符合条件的记录放到另外一张表中。请大侠们帮忙。谢谢!
如下:
test(strWhere varchar2) is
begin
insert into table1 select id from table2 where strWhere;
commit;
end;
不可用,说是sql语句出现错误。
我使用这个存储过程的原因是可以根据自己拼where条件,把符合条件的记录放到另外一张表中。请大侠们帮忙。谢谢!
可参阅一下这方面的例子,或在本论坛中查找动态SQL就OK了。
execute immediate str;
begin
insert into table1 select id from table2 where id=strWhere;
commit;
end;