Inherit a trigger? [message #78980] |
Wed, 10 April 2002 09:44 |
Tyler
Messages: 123 Registered: January 2002
|
Senior Member |
|
|
I know that this is a fairly slim chance, but I thought I would see if it was possible, without calling it from every form, procedure or otherwise. When you go into a main form, is there anyway to set the following forms that follow the form to inherit a trigger?
ie.
on-error (trigger)
declare
errnum number := ERROR_CODE;
errtype varchar2(3) := ERROR_TYPE;
begin
IF errtype = 'ORA' and errnum = 00001 then
message('A Record Already Exists Like This!');
Raise Form_Trigger_Failure;
end if;
-- this is a unique constraint violation error, and I want where ever it is raised, to show this error message on EVERY form.
end;
|
|
|
Re: Inherit a trigger? [message #78991 is a reply to message #78980] |
Thu, 11 April 2002 04:47 |
Smitha
Messages: 17 Registered: June 2001
|
Junior Member |
|
|
You can create a PL/SQL Library(.PLL file) that includes this procedure ..like error_hndl.pll that has
the
PROCEDURE check_for_redundancy IS
errnum number := ERROR_CODE;
errtype varchar2(3) := ERROR_TYPE;
begin
IF errtype = 'ORA' and errnum = 00001 then
message('A Record Already Exists Like This!');
Raise Form_Trigger_Failure;
end if;
END;
Then attach error_hndl.pll to all your forms.
Then call
check_for_redundancy;
from your triggers(on-error etc) or wherever needed.
So whenever you make modification to the library, it gets inherited to the forms(but when you make modification be sure to exit from all the forms that use this PLL, otherwise it'll not allow you to save it)
Hope this helps.
|
|
|