Mathias Stroedler wrote :
>
>Hello, 
>
>The statement gives an error? Why? What to do? Which from list?
>
>create trigger testtrigger for t2 after insert, update execute (
>    if(New.t1_id =null) then
>        stop(37892493,'a message');
>)
>
>---- Error -------------------------------
>Auto Commit: On, SQL Mode: Oracle, Isolation Level: Committed
>General error;-8010 POS(78) Table name must be in from list.
>
>- if(New.t1_id is not null) also does not work
>- even New.t1_id <> old.t1_id does not work (from the example in the
>documentation)
>
>Greets
>  Mathias
>
>-- 
>MaxDB Discussion Mailing List
>For list archives: http://lists.mysql.com/maxdb
>To unsubscribe:    
>http://lists.mysql.com/maxdb?>[EMAIL PROTECTED]
>

In the current implementation NEW/OLD are possible in update
triggers only. This is why NEW is interpreted as table name
inside the insert variant of your trigger.
As a workaround please create your trigger just as update trigger
and create a second insert trigger, which duplicates the code without
the NEW specification, i.e.

create trigger testtrigger_insert for t2 after insert execute (
    if(t1_id =null) then
        stop(37892493,'a message');

We will change this behavior in the future.

Best Regards,
Thomas


-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to