Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Autoincrement primary-key and JDBC
Hi,
I have a database table with an autoincrement-primary-key realized with a
sequence and a trigger (see below).
Everything works fine on an insert.
But how can I access/determine the generated value via JDBC?
I hope there is someone out there who can help me.
So, thanks in advance
Peter
create sequence test_table_seq
increment by 1
start with 1
minvalue 1
nomaxvalue
nocycle
nocache
noorder
;
create or replace trigger test_table_tr
before insert on test_table
for each row
begin
if
:NEW.nr is null
then
select test_table_seq.nextval
into :NEW.nr
from dual;
end if;
end;
Received on Mon May 08 2000 - 00:00:00 CDT
![]() |
![]() |