MySQL procedure SET autocommit=0; Error Code: 1064DELIMITER $$
DROP PROCEDURE IF EXISTS test.t1 $$
DELIMITER $$
CREATE PROCEDURE t1()
BEGIN
SET autocommit=0;
DECLARE cnt INT DEFAULT 0; -- it is wrong order
WHILE cnt <= 10000 DO
INSERT INTO t1 VALUES (cnt);
SET cnt = cnt +1;
END WHILE;
COMMIT;
END$$
DELIMITER ;
and when run the sql block; there was error info , follow this:
Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE cnt INT DEFAULT 0;
WHILE cnt <= 10000 DO
INSERT INTO' at line 4
[solved way]: declare must be set before autocommit;
DELIMITER $$
DROP PROCEDURE IF EXISTS test.t1 $$
DELIMITER $$
CREATE PROCEDURE t1()
BEGIN
DECLARE cnt INT DEFAULT 0; -- it is right order
SET autocommit=0;
WHILE cnt <= 10000 DO
INSERT INTO t1 VALUES (cnt);
SET cnt = cnt +1;
END WHILE;
COMMIT;
END$$
DELIMITER ;
Execution Time : 0.005 sec
Transfer Time : 0.097 sec
Total Time : 0.102 sec
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26230597/viewspace-754877/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL 的 autocommitMySqlMIT
- sql mysql variable autocommit (5)MySqlMIT
- mysql 設定禁止autocommitMySqlMIT
- Mysql-error code彙總MySqlError
- MySQL中使用procedureMySql
- error code 0x534. [SQLSTATE 42000] (Error 15404)).ErrorSQL
- SCSI error : return code = 0x10000Error
- MySQL報錯 Error_code: 1045MySqlError
- ORA-00600: internal error code, arguments: [2662], [0],Error
- MySQL Study之–MySQL關閉自動commit(autocommit)薦MySqlMIT
- SQL error 2812: Could not find stored procedure.docSQLError
- error: The shader requires a sampler in slot 0 which hasn't been set [XXXsampler]ErrorUI
- mysql_slave :Error_code: 1593解決MySqlError
- mysql procedure 中 repeat &cursor 的用法。MySql
- Windows下關閉MySQL的自動提交(autocommit)功能WindowsMySqlMIT
- error MSB8031 Building an MFC project for a non-Unicode character set is deprecatedErrorUIProjectUnicode
- pipenv install error UnicodeDecodeError: 'utf8' codec can't decode byte 0xb4 in positionErrorUnicode
- QT DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x800c000d ()QTError
- ORA-00600: internal error code, arguments: [1883], [0x000000000], [], [], [], []Error
- ORA-00600: internal error code, arguments: [2103], [1], [0], [1], [900], [], [],Error
- 【ERROR】OPatch failed with error code 73ErrorAI
- jdbc操作AutoCommitJDBCMIT
- perror error codeError
- Mysql關於procedure、function的詳解MySqlFunction
- 記一次ORA-00600: internal error code, arguments: [kcbz_check_objd_typ], [0], [0], [1], [], [], [], []ErrorOBJ
- vipca報錯 Error 0PCAError
- autocommit=0引起的業務hang住 ---轉自丁奇部落格MIT
- MySQL建立觸發器時報錯Error Code: 1064MySql觸發器Error
- MYSQL-Operating System Error Codes(錯誤程式碼)MySqlError
- MySQL 建立函式時報錯'ERROR 1336 (0A000): Dynamic SQL'MySql函式Error
- MySQL 5.6複製報錯Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND;MySqlError
- Leetcode: 627 - UPDATE, SET, ifLeetCode
- Leetcode Set Matrix ZeroesLeetCode
- mysql 儲存過程 procedure 批次建表MySql儲存過程
- 如何通過 PHP 取得 MySQL procedure 結果PHPMySql
- mysql 的procedure 中 loop迴圈的用法。MySqlOOP
- System Error CodesError
- Error parsing XML: An invalid XML character (Unicode:0x1f) was foundErrorXMLUnicode