MySQL Forums
Forum List  »  Triggers

pass table name from trigger to procedure?
Posted by: Chris Collins
Date: May 19, 2006 03:22PM

As you can see below I am trying to delete rows from tables based on the number of days defined in the trigger defined on the table.

I have read the docs but I can not determine what value to use as the tablename unless I just set one.

Any suggestions?

<code>
CREATE PROCEDURE TRUNCATE_TABLE_TO_TIME (tb varchar(32),days int(11))
-> BEGIN
-> DELETE FROM tb where timestamp <= UNIX_TIMESTAMP(DATE_SUB(CURDATE(),INTERVAL days DAY));
-> END;

CREATE TRIGGER Delete_After_Insert AFTER INSERT ON event_table
-> FOR EACH ROW BEGIN
CALL TRUNCATE_TABLE_TO_TIME( ?NEW? , 10);
-> END;
-> //
</code>

Options: ReplyQuote


Subject
Views
Written By
Posted
pass table name from trigger to procedure?
6896
May 19, 2006 03:22PM


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.