Reputation: 41
I was trying to commit a transaction in Xampp. The SQL is as follows:
BEGIN TRANSACTION;
UPDATE accounts
SET balance = balance - 1000
WHERE account_no = 100;
UPDATE accounts
SET balance = balance + 1000
WHERE account_no = 200;
INSERT INTO account_changes(account_no,flag,amount,changed_at)
values(100,'-',1000,datetime('now'));
INSERT INTO account_changes(account_no,flag,amount,changed_at)
values(200,'+',1000,datetime('now'));
COMMIT;
The error is at line 1 as-
BEGIN TRANSACTION [Unrecognized Keyword]
[]1
Upvotes: 0
Views: 1749
Reputation: 34294
There is no such statement in MySQL as begin transaction
. You can choose between start transaction
, begin
, or begin work
to start a transaction. See MySQL documentation on start transaction for further details.
Upvotes: 1