Email Us :
Free Training > SQL PL / SQL Forms Reports Oracle Applications
< Previous Next >

Forms - Using Database triggers in forms

Create a new table EMPTEN same as standard EMP Table.

Create a database trigger on the table EMPTEN by using the following code

create trigger trig1
before insert or update on empten
for each row
if :NEW.ename is null then
raise_application_error ( -20101, 'Employee name cannot be blank');
end if;

Create a new form based on table EMPTEN by using Data block wizard and layout wizard.

Save the form with the name EMP_TEN.fmb
Compile the form.
Run the form.

Click on Execute Query, As we know first record is displayed
Remove the ename and  try to save the record, we get the error.

The database trigger (trig1 ) which we have created is stopping the record to be updated.

Help  Display error is used to look at the error messages of the trigger.


< Previous Next >