Topic: To catch an error dynamic SQL
Good afternoon all.
In a cycle on meta data FK, I change type, FK
DECLARE CURSOR1 CURSOR FOR SELECT table_name, sql_restore_FK FROM Tmp_Fk_list WHERE sql_restore_FK is Not NULL ORDER BY table_name ; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN CURSOR1; MAIN_LOOP: LOOP SET @sql1 = v_sql; # SELECT @sql1; PREPARE stmt FROM @sql1; EXECUTE stmt;
1?) whether it is possible to catch an error
SELECT @@ error_count;
To see yes I see - and as in variable to write down
2?) as it is possible an error - . to write down in a broad gull-table and to continue performance
To write down all errors instead of to be interrupted on 1st of them.