sql - Creating teigger error in mysql 5.59 -


everyone. want count id's count in a(a table) when after inserting record,my sql bleow:

create trigger check_data_count after insert on each row begin      select @data_count:=count(*) id = new.id; end; 

as see, had make mistakes(^_^).

my mysql version info: ver 14.14 ditrib 5.5.9,for win64(x86).the error message is:

error code : 1064 have error in sql syntax; check manual corresponds mysql    server version right syntax use near '' @ line 8  execution time : 00:00:00:000 transfer time  : 00:00:00:000 total time     : 00:00:00:000 ---------------------------------------------------  query : end  error code : 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'end' @ line 1  execution time : 00:00:00:000 transfer time  : 00:00:00:000 total time     : 00:00:00:000 

at last, everyone.

it not possible select, update, delete on same table trigger fired.

from mysql reference manual:

b.5.9: can triggers access tables?  trigger can access both old , new data in own table. trigger can affect other tables, not permitted modify table being used (for reading or writing) statement invoked function or trigger. 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -