嗨,我一直在尝试通过 CallableStatement 调用该过程来选择多行。当我尝试将结果集填充到组合框时,代码返回错误如下。
Java错误:
java.sql.SQLException: Subquery returns more than 1 row
存储过程:
CREATE DEFINER=`user_name`@`%` PROCEDURE `GET_USER_PROFILE`(
IN p_user_id VARCHAR(150),
IN p_role VARCHAR(150),
OUT p_user_data VARCHAR(200),
OUT p_city VARCHAR(150),
OUT p_state VARCHAR(150),
OUT p_country VARCHAR(150),
OUT q_Msg VARCHAR(150))
BEGIN
DECLARE available INT DEFAULT 0;
SET p_city = (SELECT CITY FROM countries GROUP BY CITY);
SET p_state = (SELECT STATE FROM countries GROUP BY STATE);
SET p_country = (SELECT COUNTRY FROM countries GROUP BY COUNTRY);
SELECT COUNT(EMAIL) INTO available FROM STAFF_PROFILE WHERE EMAIL = p_user_id AND ROLE = p_role;
IF(available=1) THEN
SET p_user_data = (SELECT * FROM STAFF_PROFILE WHERE EMAIL = p_user_id AND ROLE = p_role );
else
SET q_Msg = 'USER_LOGGED_FIRST';
END IF;
END