mysql - Retrieving error for failed event -


i'm trying find out happen if event failed, event sql:

delimiter $$  create event if not exists `cdr2015_daily_update` on schedule every 1 day     starts (timestamp(current_date) + interval 1 day + interval 3 hour)  begin declare exit handler mysqlexception, mysqlwarning     begin     insert events_state values ('cdr2015_daily_update', 'true', now(), 'unknown', 'unknown')     end;      insert          cdr2015_v2 (clid, src, dst, dcontext, channel, dstchannel)      select          calldate, clid, src, dst, dcontext, channel, dstchannel         cdr date_format(calldate, '%y-%m-%d') = subdate(current_date, 1); -- yesterday calls   end; $$  delimiter ; 

every day @ 03:00 backup of calls day before. event fail sure, i'd know error, like:

`error code: 1136. column count doesn't match value count @ row 1` , possible catch error , insert table?  

this events_state table:

create table `events_state` ( `event` varchar(255) default null, `failed` varchar(255) default null, `fail_date` datetime, `reason1` varchar(255) default null, `reason2` varchar(255) default null, `rid` int(11) not null auto_increment, primary key (`rid`) ) engine=myisam default charset=latin1 

now event inserting this:

insert events_state values ('cdr2015_daily_update', 'true', now(), 'unknown', 'unknown') 

can changed this?

insert events_state values ('cdr2015_daily_update', 'true', now(), mysqlexception, mysqlwarning)  

also couldn't manage run event since i'm getting error on both end;, here screenshots mysql-workbench:

test test2

update: tried changing second end end; $$ end; , workbench wont display error wont run query either.

update 2: changed line insert ... 'unknown') insert ... 'unknown'); , added ; @ end of line. query runs, im getting error: error code: 1319. undefined condition: exception

about error in end,

> code > ; //this ; used close insert think > end $$ > delimiter ; 

(do not put ';'), try that, should work now


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -