MySQL Forums
Forum List  »  Stored Procedures

Trigger calling stored procedure
Posted by: Jim Whalen
Date: December 30, 2008 04:21PM

Is it possible to use use new.column name and old.column name in a stored procedure called from a trigger
Example - create trigger updt_tbl1 before update on main_table
for each row call a_stored_procedure;

The stored procedure resides within the same database and reads as follows:
Begin
update table2 set col1=new.col1, col2=new.col2 where tblkey=old.tblkey;
update table3 set col1=new.col1, col2=new.col2 where tblkey=old.tblkey;
End

I have found that the old. reference is not recognized in old.tblkey
It works OK in a trigger with a single statement but I find it will be easier to manage the statement using a stored procedure rather than dropping and restating the trigger if changes are required.

MySQL 5.1.30


TIA for any help

Jim

Options: ReplyQuote


Subject
Views
Written By
Posted
Trigger calling stored procedure
19740
December 30, 2008 04:21PM
6759
December 30, 2008 06:07PM
6060
December 31, 2008 09:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.