一、sql_mode問題sql
SET @v_rowcount = 0; select count(*) into @v_rowcount from dual where exists (select * from businstep where finance_type='5' and businflow_id='0' and step_no=3); SET @sql = IF(@v_rowcount = 0,"insert into businstep(finance_type,businflow_id,step_no,step_name,step_caption,menu_id,warn_type,pre_step_str,auto_flag) values('5','0',3,'期貨清算入帳',' ',210106,'0',' ','1'); ","update businstep set step_name='期貨清算入帳' , step_caption=' ' , menu_id=210106 , warn_type='0' , pre_step_str=' ' , auto_flag='1' where finance_type='5' and businflow_id='0' and step_no=3;"); PREPARE stmt FROM @sql; EXECUTE stmt;
執行的時候報以下錯誤:oracle
緣由是: sql_mode=oracle 不支持雙引號spa
解決方式爲:修改Mariadb的配置文件配置文件路徑:/etc/my.cnf.d/server.cnf),將原有oracle的配置模式中‘ANSI_QUOTES’去除,即將sql_mode的值修改成'PIPES_AS_CONCAT,IGNORE_SPACE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER' ;3d