存储过程如下:
create or replace procedure getmaxid(table_name in varchar2,outid out varchar2)
is
cursor curMax
is
select m.maxid from frm_maxid m where (m.bm like table_name)for update of m.maxid;
max_id number(10);
begin
open curMax;
fetch curMax into max_id;
if max_id is null or max_id='' or max_id=9999999999 then insert into frm_maxid(bm,maxid) values (table_name,'1');
close curMax;
outid:=1;
commit;
else
max_id:=max_id+1;
update frm_maxid m set m.maxid=max_id where current of curMax;
close curMax;
outid:=max_id;
commit;
end if;
end getmaxid;
但是是错误的,也无法调用和测试