mysql - mysql存储过程中的参数

标签 mysql stored-procedures

在这里,当我传递正确和不正确的值时,我得到的结果都是 4

当我执行此查询时

select Count(*) into result 
from document_details 
where document_name = name 
and document_path = path; 

然后它显示了正确答案:1。 请尽快帮助我。预先感谢您!!

create procedure check_status(IN name INT(30),IN path INT(255))    
    BEGIN
    declare result int;
    set result = 0;
    select Count(*) into result from `document_details` where `document_name`=name and `document_path`=path;
    select result;

END

最佳答案

如果类型没问题,那么应该不起作用,然后更改为 (name CHAR(30),path CHAR(255))

create procedure check_status(name INT(30),path INT(255))    
BEGIN

select Count(*) as result from `document_details` 
where `document_name`=name and     `document_path`=path;

END;

在程序中没有IN/OUT,在函数中有...

关于mysql - mysql存储过程中的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18227038/

相关文章:

mysql - Rails 数据库备份脚本

php - Zend - SELECT 语句 "AS"

sql - 消除并减少重叠的日期范围

sql - 如何在 IF 语句以及 BEGIN..END block 中使用 @@ROWCOUNT?

c# - 如何在 Entity Framework 6(代码优先)中调用存储过程?

c# - 数据库连接 InfoMessage 回调不会立即触发存储过程打印语句

php/pdo/mysql多DB调用最佳实践

mysql - SQL-从字段唯一的表中获取最新记录

mysql - 在mysql中获取一个学期的数据

sql-server - 如果满足条件则更改存储过程