传入和传出参数的MYSQL存储过程
2012-03-09 15:53
573 查看
下文为您介绍的是PHP调用MYSQL存储过程中调用传入参数的存储过程及传出参数的存储过程这两种情况,该调用方法供您参考,希望对您有所帮助。
传入参数的MYSQL存储过程
$sql = "
create procedure myproce2(in score int)
begin
if score >= 60 then
select 'pass';
else
select 'no';
end if;
end;
";
mysql_query($sql);//创建一个myproce2的存储过程
$sql = "call test.myproce2(70);";
mysql_query($sql);//调用myproce2的存储过程,看不到效果,可以在cmd下看到结果。
传出参数的MYSQL存储过程
$sql = "
create procedure myproce3(out score int)
begin
set score=100;
end;
";
mysql_query($sql);//创建一个myproce3的存储过程
$sql = "call test.myproce3(@score);";
mysql_query($sql);//调用myproce3的存储过程
$result = mysql_query('select @score;');
$array = mysql_fetch_array($result);
echo '<pre>';print_r($array);
传入参数的MYSQL存储过程
$sql = "
create procedure myproce2(in score int)
begin
if score >= 60 then
select 'pass';
else
select 'no';
end if;
end;
";
mysql_query($sql);//创建一个myproce2的存储过程
$sql = "call test.myproce2(70);";
mysql_query($sql);//调用myproce2的存储过程,看不到效果,可以在cmd下看到结果。
传出参数的MYSQL存储过程
$sql = "
create procedure myproce3(out score int)
begin
set score=100;
end;
";
mysql_query($sql);//创建一个myproce3的存储过程
$sql = "call test.myproce3(@score);";
mysql_query($sql);//调用myproce3的存储过程
$result = mysql_query('select @score;');
$array = mysql_fetch_array($result);
echo '<pre>';print_r($array);
相关文章推荐
- 深入mysql存储过程中表名使用参数传入的详解
- C#存储过程中传入传出参数
- mysql 存储过程中 limit之后使用分页变量,传入分页参数. 类似于微博游标分批次获取信息;问号参数类似于c#的string.format;问号占位符
- mysql存储过程传入两个参数,循环插入数据
- C#存储过程 传入参数 传出参数 结果集
- mysql 存储过程中表名使用参数传入
- 深入mysql存储过程中表名使用参数传入的详解
- mysql存储过程中根据传入参数,动态拼sql语句并且执行
- ibatis 调用存储过程多个传入传出参数
- 深入mysql存储过程中表名使用参数传入的详解
- [轉]MySQL存储过程例子,包含事务,参数,嵌套调用,游标,循环等
- mysql中的存储过程之无参数,in、out、inout参数的讲解
- MySQL 存储过程参数用法 in, out, inout(转)
- 对于存储过程中传入参数是否设置默认值的心得
- mysql存储过程中in、out、inout参数使用
- 在MySQL中创建带有IN和OUT参数的存储过程的方法
- 在MySQL中创建带有IN和OUT参数的存储过程的方法
- (转)MySQL 存储过程参数有三种类型:in、out、inout。它们各有什么作用和特点呢?
- MySQL存储过程例子(包含事务,输出参数,嵌套调用)
- JAVA调用Oracle存储过程传入结构化参数