Exception block inside trigger?

Bart Pietercil bart.pietercil at gmail.com
Tue Sep 25 09:20:49 CDT 2007


On 25-sep-07, at 16:03, Ivan Smahin wrote:

> Hello Bart,
>
> Tuesday, September 25, 2007, 4:41:15 PM, you wrote:
>
>> Hi List,
>
>> 1) Is it acceptable to have an exception block inside a trigger ?
>
> Hm, need to check but it should be acceptable.
>
>> 2) is this a valid trigger ? More precisely is NEW.recid acceptable
>> inside a before insert trigger ?
>
>> CREATE OR REPLACE TRIGGER "trigger_tbl_users_BI" BEFORE INSERT
>
>>      ON "tbl_users" FOR EACH ROW
>
>>      BEGIN
>>         if @user_id IS NOT null then
>>                 NEW.objptr_created_by = @user_id;
>
>>                 NEW.objptr_modified_by = @user_id;
>>         else
>>                 NEW.objptr_created_by = NEW.recid;-----> ??
>>                 NEW.objptr_modified_by = NEW.recid;---->??
>>         End IF
>>          NEW.creation_dt = NOW();
>
>>          NEW.modification_dt = NOW();
>
>>
>
>>      END;
>
> No, it is not. There is no new record yet.

OK, when I make the trigger an after insert then I can use NEW.recid?

New.recid will then refer to the just created record ?

Will an after insert trigger trigger an before of after UPDATE  
trigger when it changes the record ?

TIA

Bart


More information about the Valentina mailing list