Edson Richter wrote : >Hi!
>I'm trying to create a trigger for insert into a table. I want to make >something only when :new.CO_TIPO_EVENTO = 2. >So, I do >if new.CO_TIPO_EVENTO = 2 > then UPDATE TB1 SET V = 2 WHERE CO_EVENTO = :new.CO_EVENTO >When I compile, I get an error saying that the table is required. If my >trigger is for INSERT, UPDATE I can compile it fine. >Can someone help me? Is not possible to use new on an if when the trigger is >for INSERT? I already checked the docs, and they are not clear about this. >Thanks, >Edson Richter Please just omit the NEW specification. In insert triggers only the new column values of the triggering table are available. NEW therefore is assumed implicitly. if CO_TIPO_EVENTO = 2 then UPDATE TB1 SET V = 2 WHERE CO_EVENTO = :CO_EVENTO Best Regards, Thomas --- Thomas Anhaus SAP Labs Berlin -- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
