Skip to content

Instantly share code, notes, and snippets.

@carlsverre
Created June 11, 2021 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlsverre/0dcb088e96e08970e8e9802bb53bae79 to your computer and use it in GitHub Desktop.
Save carlsverre/0dcb088e96e08970e8e9802bb53bae79 to your computer and use it in GitHub Desktop.
create database if not exists t;
create database if not exists t2;
use t;
create table if not exists x (id int);
delimiter //
create or replace procedure foo (i int) as
begin
start transaction;
insert into t.x values (i);
insert into x values (i);
commit;
end //
delimiter ;
use t2;
create table if not exists x (id int);
-- this will fail
use t2;
call t.foo (1);
-- this will succeed
use t;
call t.foo (1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment