Re: SQL*Froms v3 - Trigger Failure
Date: 15 May 93 20:54:39 GMT
Message-ID: <sXZL4B1w165w_at_uidixon.uucp>
moswald_at_cwis.unomaha.edu (Mike Oswald) writes:
> In v2.3 you could write an trigger step like this:
>
> #exemacro case :<field1> is
> when '' then message <...>; ENDTRIG; -or- ENDTRIG FAIL;
> when others then <..blah..> ;
> end case;
>
> Rather simple but how does ENDTRIG; work in v3? I've tried using the
> RAISE FORM_TRIGGER_FAILURE but I must be missing something.
>
> All I want to do is to do some checking and in a PRE-INSERT or PRE-UPDATE
> fire off a trigger that does the checking. If it fails I want the COMMITING
> process to halt.
I presume you mean fire off a procedure to do the checking but the idea is the same.
You need to check that things have worked as you go back up the levels. So for example if the PRE-INSERT calls a procedure to check that <field-1> is not null you might have:
PRE-INSERT
check_field_1_for_null;
if not FORM_SUCCESS then
raise FORM_TRIGGER_FAILURE;
and this procedure defined
PROCEDURE check_field_1_for_null IS
begin
if :field_1 is NULL then
raise FORM_TRIGGER_FAILURE;
end;
That should get things working.
BTW your example shows something that I liked about 2.3 which isnt in Forms 3 - the case statement.
Regards
Ian
-- Ian Dixon Email : idixon_at_infocom.co.uk Reading, EnglandReceived on Sat May 15 1993 - 22:54:39 CEST