trigger WHEN
Posted in 2000
Topics: Triggers, Constraints & Referential Integrity
When I created a trigger, Informix seems to have added a few "(" around
my
"WHEN" conditional. I have tried a few different ways, but the problem
persists. Any ideas?
example:
Here is the syntax I send to the database:
create trigger my_trig update of change_date on my_table
referencing old as pre new as post
for each row
WHEN((pre.timestamp is not null) AND (USER != 'me')
AND (pre.timestamp != post.timestamp)
AND (pre.column_value = post.column_value))
(insert into my_table ...and so on
This is what is created:
create trigger my_trig update of change_date on my_table
referencing old as pre new as post
for each row
WHEN(((((pre.timestamp is not null) AND (USER != 'me')
)) AND (pre.timestamp != post.timestamp)
)) AND (pre.column_value = post.column_value)))
(insert into my_table ...and so on
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
informix wrote:
> When I created a trigger, Informix seems to have added a few "(" around
> my
> "WHEN" conditional. I have tried a few different ways, but the problem
> persists. Any ideas?
>
> example:
>
> Here is the syntax I send to the database:
>
> create trigger my_trig update of change_date on my_table
> referencing old as pre new as post
> for each row
> WHEN((pre.timestamp is not null) AND (USER != 'me')
> AND (pre.timestamp != post.timestamp)
> AND (pre.column_value = post.column_value))
> (insert into my_table ...and so on>
> This is what is created:
>
> create trigger my_trig update of change_date on my_table
> referencing old as pre new as post
> for each row
> WHEN(((((pre.timestamp is not null) AND (USER != 'me')
> )) AND (pre.timestamp != post.timestamp)
> )) AND (pre.column_value = post.column_value)))
> (insert into my_table ...and so on
Have the extra parentheses altered the meaning of the WHEN clause?
I don't think so. So what is the trouble?
If you get upset about this, try creating a view and look at what Informix
does to your view text.
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN
#include <disclaimer.h>
Yes the engine adds a few layers of parenthesis to triggers and views (as
Jonathan hints) it is normally harmless. Sometimes this produces a trigger
or view that dbschema or myschema can output to disk but which dbaccess or
the engine will not accept. If this is happening to you report it to tech
support. The more reports the faster it will be fixed.
Jonathan Leffler wrote:
>
> informix wrote:
>
> > When I created a trigger, Informix seems to have added a few "(" around
> > my
> > "WHEN" conditional. I have tried a few different ways, but the problem
> > persists. Any ideas?
> >
> > example:
> >
> > Here is the syntax I send to the database:
> >
> > create trigger my_trig update of change_date on my_table
> > referencing old as pre new as post
> > for each row
> > WHEN((pre.timestamp is not null) AND (USER != 'me')
> > AND (pre.timestamp != post.timestamp)
> > AND (pre.column_value = post.column_value))
> > (insert into my_table ...and so on> >
> > This is what is created:
> >
> > create trigger my_trig update of change_date on my_table
> > referencing old as pre new as post
> > for each row
> > WHEN(((((pre.timestamp is not null) AND (USER != 'me')
> > )) AND (pre.timestamp != post.timestamp)
> > )) AND (pre.column_value = post.column_value)))
> > (insert into my_table ...and so on>
> Have the extra parentheses altered the meaning of the WHEN clause?
>
> I don't think so. So what is the trouble?
>
> If you get upset about this, try creating a view and look at what Informix
> does to your view text.
Art S. Kagel