📜  proc - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:26.283000             🧑  作者: Mango

代码示例1
drop procedure if exists get_user;
delimiter #
create procedure get_user
(
in p_user_id int unsigned,
in p_explain tinyint unsigned
)
begin
  if (p_explain) then
    explain select * from users where user_id = p_user_id;
  end if;
  select * from users where user_id = p_user_id;
end#

delimiter ;

call get_user(1,1);