设为首页 加入收藏

TOP

2014/7/24
2015-07-24 11:10:54 来源: 作者: 【 】 浏览:2
Tags:2014/7/24

初学存储过程

DELIMITER // 定义写存储过程中的结束符为 //

创建存储过程1:

create procedure proce_userinfo(in name varchar(10) ,int pwd varchar(10),out flag int)

begin

select power from user where Username=name and password=pwd into flag;

end //

创建存储过程2:

create procedure proc_reg(in name varchar(10),in pwd varchar(10),out flag int)
begin
set @count=0;
select count(*) from users where username=name into @count;
if @count>0 then

set flag=0;
else
set flag=1;
insert into users(username,passwords)values (name,pwd);
end if;
end

declare 只是声明,set既声明又赋值


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇INS-20802 下一篇Linux下没有my.cnf文件的解决方式..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·About - Redis (2025-12-26 08:20:56)
·Redis: A Comprehens (2025-12-26 08:20:53)
·Redis - The Real-ti (2025-12-26 08:20:50)
·Bash 脚本教程——Li (2025-12-26 07:53:35)
·实战篇!Linux shell (2025-12-26 07:53:32)