Skip to content

Instantly share code, notes, and snippets.

@Jammink2
Created February 6, 2017 20:24
Show Gist options
  • Save Jammink2/7ef8b765957e86fae0f3a10eaa1047c2 to your computer and use it in GitHub Desktop.
Save Jammink2/7ef8b765957e86fae0f3a10eaa1047c2 to your computer and use it in GitHub Desktop.
For Splice Machine Tutorial Video: Using Command Prompts for Transactions
-- This is actually a tutorial about keeping the thing open in multiple sessions
-- in it, we open two consoles and try commands across each one
--first console
autocommit off;
create schema CP;
set schema CP;
create table DOMAIN_DATA(code varchar(2), description varchar (20));
insert into DOMAIN_DATA values ('F', 'Female');
-- switch to second console, run select statement
-- get error; data not committed yet
commit;
-- switch to second console
-- data is shown in second session
insert into DOMAIN_DATA values ('U', 'Unknown');
commit;
-- two rows shown for 'select * from DOMAIN_DATA;'' in second session
-- create savepoint
savepoint savept1;
insert into DOMAIN_DATA values ('M', 'Male');
select * from DOMAIN_DATA;
-- this will actually show all three rows
-- rollback to savepoint
rollback to savepoint savept1;
-- now, select statement on both consoles will only show before the rollback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment