Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Triggers & Validations

Re: Triggers & Validations

From: john sprague <bearpig_at_attglobal.net>
Date: Thu, 21 Jun 2001 22:13:08 -0500
Message-ID: <3B32B7C4.963647AC@attglobal.net>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US