-1
私はFedora 25のMariaDB 10.1.25とSQLエディタとしてDBeaverでこのトランザクションを実行しようとしています。MariaDBトランザクションの試行でエラーが発生しました
各クエリだけで正常に動作しますが、トランザクションブロックでラップすると常に失敗します。
BEGIN;
INSERT INTO quality.tb_account (email, password, registration_date, active, screen_name)
VALUES ('[email protected]', 'password', CURRENT_DATE(), TRUE, 'user11');
INSERT INTO quality.tb_account_roles (account_id, role_id)
VALUES (LAST_INSERT_ID(), 1);
COMMIT;
エラーは次のいずれかです。
SQL Error [1064] [42000]: (conn:2) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INSERT INTO quality.tb_account (email, password, registration_date, active, scre' at line 2
Query is : BEGIN;
INSERT INTO quality.tb_account (email, password, registration_date, active, screen_name) VALUES ('[email protected]', 'password', CURRENT_DATE(), TRUE, 'user11');
INSERT INTO quality.tb_account_roles (account_id, role_id) VALUES (LAST_INSERT_ID(), 1);
COMMIT
(conn:2) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INSERT INTO quality.tb_account (email, password, registration_date, active, scre' at line 2
Query is : BEGIN;
INSERT INTO quality.tb_account (email, password, registration_date, active, screen_name) VALUES ('[email protected]', 'password', CURRENT_DATE(), TRUE, 'user11');
INSERT INTO quality.tb_account_roles (account_id, role_id) VALUES (LAST_INSERT_ID(), 1);
COMMIT
org.mariadb.jdbc.internal.util.dao.QueryException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INSERT INTO quality.tb_account (email, password, registration_date, active, scre' at line 2
Query is : BEGIN;
INSERT INTO quality.tb_account (email, password, registration_date, active, screen_name) VALUES ('[email protected]', 'password', CURRENT_DATE(), TRUE, 'user11');
INSERT INTO quality.tb_account_roles (account_id, role_id) VALUES (LAST_INSERT_ID(), 1);
COMMIT
私が間違って何をやっています?それぞれのクエリは単独で動作するが、一緒に動作するのはなぜですか?
助けてくれてありがとう! – rojoherrero