Subject Re: [firebird-support] CASE Statement annidation
Author Arno Brinkman
Hi,

> I'm trying to write a trigger that log to a table all user operations.
>
> So I write someting like this:
> CREATE TRIGGER table1_log FOR table1
> ACTIVE AFTER INSERT OR UPDATE OR DELETE POSITION 0
<snip>

> but in the (updating) CASE, when I try to insert another CASE IBExpert
> return a precompiler error.
>
> My question is:
>
> It is possible to annidiate CASE statement? If not how can I write my
> trigger to obtain same result?

What do you meant with annidate?, but if you meant nested CASE expressions,
yes that is possible.

> when (updating) then
> 'UPDATE table1 SET fieldkey='||new.fieldkey
> || case when (new.field1#old.field1) then
^^^^^^^^^^^^^^^
> ',field1='||new.field1|| end
> || case when (new.field2#old.field2) then
^^^^^^^^^^^^^^^^
> ',field2='||new.field2|| end

What do you meant with :
new.field2#old.field1

# ?

Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/

Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com

Nederlandse firebird nieuwsgroep :
news://newsgroups.firebirdsql.info