Can mySql have the SQLserver @ error variable, or the trycatch syntax in c. MySQL catch exceptions ** does mySql have the @ error variable of SQLserver, or the trycatch syntax in c. The answer is yes. The instance code is as follows: ** CodeDROPPROCEDUREIFEXISTSsp_call_jobs; CREATE
Does mySql have the SQLserver @ error variable, or the try catch syntax in c. MySQL exception capture/** does mySql have the @ error variable of SQLserver, or the try catch syntax in c. The answer is yes. The instance code is as follows: **/CodeDROP procedure if exists sp_call_jobs; CREATE
Does mySql have the SQLserver @ error variable, or the try catch syntax in c. MySQL exception capture
/** Does mySql have @'s @ error variable, or the try catch syntax in c. The answer is yes. The instance code is as follows: **/CodeDROP procedure if exists sp_call_jobs; create procedure sp_call_jobs () not deterministic SQL SECURITY DEFINER COMMENT ''BEGINdeclare _ row, _ err, _ count int default 0; declare continue handler for sqlexception, SQLWARNING, not found set _ err = 1; while _ row <3 do start transaction; insert into t1 (cond_val) values (null); COMMIT; if _ err = 1 then set _ count = _ count + 1; end if; set _ row = _ row + 1; en D while; select _ count; END;/** statement: declare continue handler for sqlexception, SQLWARNING, not found set _ err = 1; it is used when SQLEXCEPTION, SQLWARNING, when the not found error occurs, SET _ err = 1 and execute the CONTINUE operation, that is, CONTINUE to execute the following statement. This is similar to the try catch syntax in c. We also use the TRANSACTION statement: start transaction ;...... COMMIT; can ensure integrity. **/