Skip to Main Content

Oracle Forms

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!

trigger Pre-Insert of Data Block doesn't work for me

722976Oct 8 2009 — edited Oct 9 2009
Oracle 10g
Forms Builder 10.1.2.0.2
Windows XP

=================================================================

Hello everyone, I am a newbie in Oracle Forms, really need help to figure out the issue of Pre-insert trigger.

I created form DEPT by following a tutorial, then data block DEPARTMENT was generated by data block wizard. at this stage, I got everything runs well, data appears correctly. So I want to use an Oracle Sequence in datablock which should generate & display the new ID in the field when user click on icon "Insert Record"on toolbox.

Firstly, the auto_sequence runs correctly by SQL*PLUS
*********************************************
select DEPT_ID_SEQ.nextval from DUAL;
*********************************************


Then I insert code as follows in trigger PRE-INSERT of DATA BLOCK.

*****************************************************
type: trigger
object: department - Data Block Level
*****************************************************
begin
select DEPT_ID_SEQ.nextval
into :DEPARTMENT.ID
from DUAL;
end;
****************************************************


finally, I save + compile module + run form, I didn't see an auto-generated ID in the ID field once I clicked the icon "insert records".

Then I made a button call "New ID", then inserted the code above into button's trigger "WHEN-BUTTON-PRESSED", re-run the form, it works!

For my understand, the icon "Insert Record" on toolbar doesn't active the trigger "PRE-INSERT".

Why?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 6 2009
Added on Oct 8 2009
5 comments
5,200 views