日期:2014-05-17 浏览次数:20726 次
tony@ORCL1> create table tmp(id int, val int); Table created. tony@ORCL1> declare v int; begin insert into tmp values(1,1); select max(val) into v from tmp; end; 2 / PL/SQL procedure successfully completed.
------解决方案--------------------
declare
v_id number(2);
v_name varchar2(3);
v_sql varchar2(256);
begin
select max(ID) into v_id from TableName;
v_name := 'xxx';
v_sql := 'insert into TableName(ID,MYNAME) values (:1,:2)';
execute immediate v_sql using v_id,v_name;
commit;
end;