INSERTION using sequence [message #352275] |
Mon, 06 October 2008 23:08 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
illpraydo
Messages: 7 Registered: October 2008 Location: Australia
|
Junior Member |
|
|
Hello everyone,
i 've got this problem while designing a database
a database table called project with 3 fields project ID number(3) Primary key, project info varchar2(20), and active char(1) shows whether a project active or inactive
the design is whenever user creating a new record the system will trigger auto sequence insertion to the Primary key, and the fields is not visible in oracle forms layout, however project ID is invoked in datablocks.
the problem is whenever i insert new record the form runtime keeps saying insertion error and the value of sequence is incremented by 50 from previous value.
how is that happen? and how to fix it?
|
|
|
|
Re: INSERTION using sequence [message #352319 is a reply to message #352289] |
Tue, 07 October 2008 01:53 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
illpraydo
Messages: 7 Registered: October 2008 Location: Australia
|
Junior Member |
|
|
it is the database trigger
hm.. I've already solve the problem, and i want to share the problem with you guys
it was my database trigger
using 'INSERT' operation
the correct one will be
CREATE OR REPLACE TRIGGER TRIG_NAME
BEFORE INSERT
ON ORACLESCH.TABLE_NAME
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
SELECT SEQUENCE_NAME.NEXTVAL
INTO :.new.PRIMARY KEY
From Dual;
END;
/
|
|
|
|