sqlserver的@@IDENTITY在oracle中怎样实现
sqlserver的@@IDENTITY在oracle中怎样实现?
create sequence SEQ1
minvalue 1
maxvalue 99999999999
start with 1
increment by 1
cache 20;
begin
select seq1.nextval into idnum from dual;
select seq1.currval into idnum from dual; ---应增加此条语句就可以了
insert into a(id,t1,t2) values(idnum,'a','b');
insert into b(t3,t4) values(idnum,'c');
end
create sequence SEQ1
minvalue 1
maxvalue 99999999999
start with 1
increment by 1
cache 20;
begin
select seq1.nextval into idnum from dual;
select seq1.currval into idnum from dual; ---应增加此条语句就可以了
insert into a(id,t1,t2) values(idnum,'a','b');
insert into b(t3,t4) values(idnum,'c');
end