use last_insert_id

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
This commit is contained in:
Shlomi Noach 2021-07-06 09:05:49 +03:00
parent ed9a91dac6
commit bce9e3974c

View File

@ -27,6 +27,6 @@ begin
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":19}');
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":23}');
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":27}');
update gh_ost_test set jsonobj=JSON_OBJECT('_id', 27, 'name', 'carrot') where id>0 and idb=27;
set @last_insert_id := last_insert_id();
update gh_ost_test set jsonobj=JSON_OBJECT('_id', 27, 'name', 'carrot') where id=@last_insert_id and idb=27;
end ;;