> CREATE TRIGGER trigger_name AFTER UPDATE ON table
> BEGIN
>   SELECT CASE
>     WHEN a_condition THEN
>       UPDATE another_table SET a_field=a_value WHERE yet_another_condition
>     WHEN another_conditon THEN
>       UPDATE another_table SET a_field=another_value WHERE 
> yet_another_condition
>     END; 
> END
> 
> When I try to create the trigger it returns an error before update (or
> similar - sorry do not have access to my PC at the moment to get the
> exact error).
> 
> Can sqlite3 do the above?

I don't think that's regular SQL. You could create two triggers and put
the condition as a WHEN clause on the trigger. i.e.:

CREATE TRIGGER trigger_name AFTER UPDATE ON table
  WHEN (some_condition) BEGIN
    UPDATE another_table SET a_field=a_value WHERE yet_another_condition
  END;

And another similar trigger for the other with "WHEN (!some_condition)".




                
____________________________________________________
Sell on Yahoo! Auctions – no fees. Bid on great items.  
http://auctions.yahoo.com/

Reply via email to