Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 存储过程始终返回0_Mysql_Stored Procedures_Procedure - Fatal编程技术网

Mysql 存储过程始终返回0

Mysql 存储过程始终返回0,mysql,stored-procedures,procedure,Mysql,Stored Procedures,Procedure,memberStatus始终返回0。但是当我单独运行查询时,它工作正常 DROP PROCEDURE IF EXISTS getMySubjectLists; DELIMITER $$ CREATE PROCEDURE getMySubjectLists( IN myID INT, IN GID INT ) BEGIN DECLARE memberStatus INT DEFAULT 0; SELECT COALESCE(s

memberStatus始终返回0。但是当我单独运行查询时,它工作正常

DROP PROCEDURE IF EXISTS getMySubjectLists;

DELIMITER $$

CREATE PROCEDURE getMySubjectLists(
     IN myID    INT,        
     IN GID     INT
)
BEGIN
    DECLARE memberStatus INT DEFAULT 0;

    SELECT COALESCE(status,0) into memberStatus from member_access where group_id = GID and subject_id = 0 and topic_id = 0 and subtopic_id = 0 
        and member_id = myID;

        insert into apps_log values(0,memberStatus,GID,myID,"",now());  

END$$
DELIMITER ;
为成员访问创建表如下所示。该过程不仅适用于此特定表。我试过用其他桌子,效果不错

CREATE TABLE `member_access` (
 `seqno` int(11) NOT NULL AUTO_INCREMENT,
 `mapid` int(11) NOT NULL,
 `group_id` int(11) NOT NULL,
 `subject_id` int(11) NOT NULL,
 `topic_id` int(11) NOT NULL,
 `subtopic_id` int(11) NOT NULL,
 `member_id` int(11) NOT NULL,
 `access_code` int(11) DEFAULT '0',
 `delegate_code` int(11) DEFAULT '0',
 `specialid1` int(11) DEFAULT '0',
 `specialid2` int(11) DEFAULT '0',
 `specialid3` int(11) DEFAULT '0',
 `status` int(11) DEFAULT '0',
 `created` datetime DEFAULT NULL,
 `updated` datetime DEFAULT NULL,
 PRIMARY KEY (`seqno`),
 KEY `indx1` (`mapid`,`access_code`,`status`),
 KEY `mig1` (`mapid`,`member_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

您是否正在使用任何报告工具或程序来显示此过程的结果?我无法重现您指示的行为。我尝试使用其他表,但对于这个特定的表成员访问,我无法检索值。我添加了创建表。使用新的表结构,它似乎也能工作。您是否正在使用任何报告工具或程序来显示此过程的结果?我无法重现您指示的行为。我尝试使用其他表,但对于这个特定的表成员访问,我无法检索值。我添加了创建表。使用新的表结构,它似乎也能工作。