MySQL Forums
Forum List  »  Triggers

Re: How can I create a trigger that increments on read?
Posted by: Roland Bouman
Date: November 01, 2006 04:28AM

delimiter $

create trigger bir_table1
before insert on table1
for each row
begin

-- put code here

end;
$

this creates a trigger called bir_table1 that will fire right before a row is inserted into table1. Between the begin and the end markers you can put the code you want to execute.

The before trigger allows you to modify the data of the record current being inserted. If you don't need that, you can also use an after trigger.


good luck,

Roland

Options: ReplyQuote




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.