clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2335693 fiddles created (27452 in the last week).

create table t(id int UNIQUE,v varchar(10));
 hidden batch(es)


insert into t (id,v) values (2,'c'),(3,'a'), (5,'b');
 hidden batch(es)


select * from t
id v
2 c
3 a
5 b
 hidden batch(es)


CREATE PROCEDURE procedure_name(IN _a BIGint , IN _b BIGint) BEGIN CREATE TEMPORARY TABLE T1 SELECT _b,v FROM t WHERE id = _a; DELETE FROM t WHERE id = _a; UPDATE t SET id = _a WHERE id = _b; INSERT INTO t SELECT * FROM T1; END
 hidden batch(es)


CALL procedure_name(3,5)
 hidden batch(es)


select * from t
id v
2 c
3 b
5 a
 hidden batch(es)