mysql存储过程的一个容易例子

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

mysql存储过程的一个容易例子

相关文章:

你感兴趣的文章:

标签云: