472,133 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

need example for Triggers

donilourdu
hi I am doni

I need example for tigger in MySQL database.

looking for replies

with regards,
doni
Jan 12 '07 #1
4 4099
ronverdonk
4,258 Expert 4TB
In assume you do not mean TIGGERS but TRIGGERS?
What have you done to get the info from the standard MySQL documentation?That shows samples. See Triggers

You also do not specify for what situation you'd need it. Do we have to guess?

Ronald :cool:
Jan 12 '07 #2
In assume you do not mean TIGGERS but TRIGGERS?
What have you done to get the info from the standard MySQL documentation?That shows samples. See Triggers

You also do not specify for what situation you'd need it. Do we have to guess?

Ronald :cool:
thank you for reply
well Ronald I already know that site. But It cant be clear for me. Could you give me a simple example
Jan 12 '07 #3
ronverdonk
4,258 Expert 4TB
Okay, this is a simple example.
Assume: each time a row is inserted in table MyTable you want to log that event by adding a row to LogTable.
Expand|Select|Wrap|Line Numbers
  1. CREATE TRIGGER logit AFTER INSERT ON MyTable
  2. FOR EACH ROW 
  3. BEGIN
  4.   INSERT INTO LogTable (timestamp, message)
  5.   VALUES(NOW(), 'row added to MyTable');
  6. END;
  7.  
A good article with samples is shown at the OnLamp site at MySQL Triggers tryout

Ronald :cool:
Jan 12 '07 #4
[thank you Very much Ronald for your example.
It realy helpful for me.

with regards,
Doni

Okay, this is a simple example.
Assume: each time a row is inserted in table MyTable you want to log that event by adding a row to LogTable.
Expand|Select|Wrap|Line Numbers
  1. CREATE TRIGGER logit AFTER INSERT ON MyTable
  2. FOR EACH ROW 
  3. BEGIN
  4.   INSERT INTO LogTable (timestamp, message)
  5.   VALUES(NOW(), 'row added to MyTable');
  6. END;
  7.  
A good article with samples is shown at the OnLamp site at MySQL Triggers tryout

Ronald :cool:
Jan 13 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Mark Flippin | last post: by
11 posts views Thread by William Payne | last post: by
debasisdas
reply views Thread by debasisdas | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.