Home > Database > Mysql Tutorial > body text

2014/7/24

WBOY
Release: 2016-06-07 15:59:03
Original
1203 people have browsed it

初学存储过程 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

初学存储过程

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既声明又赋值


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template