mysql存储过程的一个简单例子

create procedure hello()
begin
declare a int default 0;
  declare b int;
  declare c int default 0;
  set a = 1;
set b =2;

if a> b || a=1 then
  set c= a + b;
end if;
select c as sum;
end;

=========================

CREATE PROCEDURE `sum1`( a int ,b int)
begin
    declare c int;
   if a is null then
     set a = 0;
    end if;
   if b is null then
       set b = 0;
  end if;
  set c = a+ b;
select c as sum;
end

猜你喜欢

转载自liuxueping1987.iteye.com/blog/1462783