sql存储过程

sql存储过程:是一组为了完成特定功能的sql语句集

       是 一个可编程的函数,它在数据库中创建并保存

1:修改标识符

delimiter $$

2:调用

call pro_showNum()

3删除

drop pro_showNum

 

delimiter $$
create procedure pro_showNumber(in num1 int,in num2 int, inout num3 int )
begin
declear num1 int ;                //声明变量
declear num2 int default 10;  //声明变量,设置初始值10
set num1 :=2;                    //设值
set num2:=num2+3;

select 列名1,列明2 into num1, num2 from  表名   where  过滤条件

select num1,num2 from dual
end$$

 

 

 

一  if 条件 then sql语句集

      end if

 

二 if 条件  then  sql语句集

 else sql语句集

  end if

 

posted @ 2017-07-02 17:12  红烧鱼l  阅读(100)  评论(0编辑  收藏  举报