MySQL PLSQL Demo - 002.变量定义、赋值

时间:2021-09-24 04:56:28
drop procedure if exists p_hello_world;

create procedure p_hello_world()
begin
declare v_number int;
declare v_varchar varchar(32);
set v_number = 1;
set v_varchar = 'hello world'; -- for debug
select v_number;
select v_varchar;
end; call p_hello_world();

drop procedure if exists p_hello_world;

create procedure p_hello_world()
begin
    declare v_number int;
    declare v_varchar varchar(32);
    set v_number = 1;
    set v_varchar = 'hello world';

-- for debug
    select v_number;
    select v_varchar;
end;

call p_hello_world();