首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

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

2012-07-02 
mysql存储过程的一个简单例子create procedure hello()begindeclare a int default 0declare b intdecla

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

热点排行