技术人员——即使我知道我有 2 行,其中 1 行与 000020 上的 EMPNO 匹配,而另一行在 000030 上匹配,我得到一个空结果集。有任何想法吗?
这是电话:
CALL DB2INST1.EMP_MULTIPLE_XML(XMLPARSE(
DOCUMENT '<EMPLOYEE><EMPNO>000020</EMPNO><EMPNO>000030</EMPNO></EMPLOYEE>'));
这是更改后的存储过程:
BEGIN
CREATE PROCEDURE DB2INST1.EMP_MULTIPLE_XML (IN DOC XML)
DYNAMIC RESULT SETS 1
READS SQL DATA
LANGUAGE SQL SPECIFIC EMP_MULTIPLE_XML
DECLARE CSR1 CURSOR WITH RETURN FOR
SELECT emp.EMPNO,
emp.FIRSTNME,
emp.LASTNAME,
emp.WORKDEPT
FROM DB2INST1.EMPLOYEE emp
WHERE emp.EMPNO IN
(SELECT X.EMPNO FROM
XMLTABLE('$d/EMPLOYEE/EMPNO' PASSING DOC AS "d" COLUMNS EMPNO CHAR(6) PATH 'EMPNO') AS X);
OPEN CSR1;
END