Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

sequence nextval called twice on insert

grodnoDec 27 2011 — edited Dec 28 2011
Hey,

myTableVO.id is populated by sequence nextval expression (update when new only)
there is a pre-insert trigger on table MyTable with a statement select nvl(:new.id,my_seq.nextval) into :new.id from dual; in it

each time a new row is inserted, i see the new id value is increased by 2, rather than 1.

the code in backing bean that manages the insert's attributes shows that the statement
res=newRow.getAttribute("Id").toString();

returns already doubled value.

what's wrong? how can i avoid calling nextval twice a call?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 25 2012
Added on Dec 27 2011
10 comments
1,092 views