I have this issue. Ive been learning SQL for a while now and I am testing out the rollback feature and so i created a simple table and populated it with fake data and created a "savepoint" and then try to rollback to it. My compiler shows it creates the "savepoint" and then when i try to rollback to it, it says it doesnt exsit yet it clearly just created the savepoint with no issue. Im pretty sure i didnt write anything wrong so i am not sure whats going on. Here is the code. If you can take a look and tell me whats wrong that would be greatly appricated!
Code:
use learnsql;
insert into customer_tbl values
(
'615', 'FRED WOLF', '109 MEMORY LANE', 'PLAINFEILD', 'IN', '46113', '3175555555', NULL
);
insert into customer_tbl values
(
'559', 'RITA THOMPSON', '125 PEACHTREE', 'INDIANAPOLIS', 'IN', 46248, 3171111111, NULL
);
insert into customer_tbl values
(
'715', 'BOB DIGGLER', '1102 HUNTINGTON ST', 'SHELBY', 'IN', 41234, 3172222222, NULL
);
savepoint SAVEPOINT1;
update customer_tbl
set CUST_NAME ='FRED WOLF'
where CUST_ID = '559';
update customer_tbl
set CUST_ADDRESS = 'APT C 4556 WATERWAY'
where CUST_ID = '615';
update customer_tbl
set CUST_CITY = 'CHICAGO'
where CUST_ID = '715';
rollback to SAVEPOINT1;
select*from learnsql.customer_tbl;
For want of a nail...the horseshoe was lost. For want of a horseshoe, the steed was lost. For want of a steed...the message was not delivered. For want of an undelivered message.....the war was lost.
I'll start with the obvious (to me ) first question: does the table in question use the InnoDB storage engine (the only one that supports this feature, I believe)?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Yes it does, I figured it out; looks like autocommit was turned on therefore after every action it wiped the saves clean. Thanks though!
For want of a nail...the horseshoe was lost. For want of a horseshoe, the steed was lost. For want of a steed...the message was not delivered. For want of an undelivered message.....the war was lost.
Bookmarks