Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Triggers & Validations
Construct the trigger as a shell which calls the validations as 7 stored proceedures wrapped as packages.
Trigger before blah blah ...
mypack.validation1(input input input, success_var_output);
if success_var_output = 'AOK' then
mypack.validation2(input input input, success_var_output); end if;
if success_var_output = 'AOK' then
.......validation3(......);
end if;
Now - at the end of the trigger - linearly .. as in after the validation id-then blocks ... review the value of the success_var_output and decide if a message should be returned to the user. I love the developer defined error messages possible to return to the user - but they trigger (gasp) application level errors. Rarely wil I NOT want aplication level errors raised when a trigger validation scheme is violated - but that is another story . ( When is a trigger not a trigger...).
jds
William O'Neill wrote:
> Am using Powerbuilder, v6.5.1 and Oracle 8.1.6 on WINNT. Would like to
> create a 'Before Insert' or 'Update' trigger on a particular table, and in
> this trigger validate 7 fields from the database. My question: if a
> validation fails(lets say, the first 3 are fine, but the 4th errors), then,
> I would like to stop the further processing of the trigger, and if possible,
> return an error message to the user, telling him where the failure was. Is
> this possible? A colleague suggested that I couldn't code in the trigger a
> Messagebox(from Powerbuilder) with an appropriate message, because at this
> point(the middle of a trigger) I was in the Oracle environment. What do you
> think?
Received on Thu Jun 21 2001 - 22:13:08 CDT