Home » Developer & Programmer » Forms » INSERTION using sequence (Oracle Forms 6i in Windows XP)
INSERTION using sequence [message #352275] Mon, 06 October 2008 23:08 Go to next message
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 #352289 is a reply to message #352275] Mon, 06 October 2008 23:48 Go to previous messageGo to next message
Littlefoot
Messages: 21148
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
system will trigger auto sequence insertion to the Primary key
How did you do that? A database trigger? A form trigger? How does the code look like?

Quote:
whenever i insert new record the form runtime keeps saying insertion error
Go to Help menu, select Display Error and tell us the exact error code/message.

Quote:
value of sequence is incremented by 50 from previous value
How did you create a sequence (exact statement you have used)? Does it contain "INCREMENT BY 50" by any chance? Otherwise, it might be the number of cached numbers that causes such a behaviour.
Re: INSERTION using sequence [message #352319 is a reply to message #352289] Tue, 07 October 2008 01:53 Go to previous messageGo to next message
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;
/


Re: INSERTION using sequence [message #352320 is a reply to message #352319] Tue, 07 October 2008 01:54 Go to previous message
illpraydo
Messages: 7
Registered: October 2008
Location: Australia
Junior Member
before i was using 'insert' instead of 'select' on the trigger
Previous Topic: Managing data block based on outer join
Next Topic: "Enabled" property not working
Goto Forum:
  


Current Time: Sat Aug 19 08:19:13 CDT 2017

Total time taken to generate the page: 0.02570 seconds