我正在尝试将DB2过程查询迁移到MySQL过程。这是MySQL中的最终转换过程。
CREATE PROCEDURE SAMPLE
(
INOUT CLIENT_ID BIGINT,
OUT CONFIG XML
)
BEGIN
DECLARE CP_ID BIGINT;
DECLARE CP_NAME VARCHAR(38);
SET (CP_ID) = (SELECT PROFILE FROM CLIENT WHERE ID=CLIENT_ID LIMIT 1);
SET (CP_NAME) = (SELECT NAME FROM CLIENT WHERE ID=CP_ID LIMIT 1);
SET CONFIG = (
XMLELEMENT(NAME "characteristic",
XMLATTRIBUTES('ClientInfo' AS "name"),
(
XMLELEMENT(NAME "characteristic",
XMLATTRIBUTES('ClientProfileData' AS "name"),
XMLELEMENT(NAME "param", XMLATTRIBUTES('isSupport' AS "name", 'false' AS "value")),
XMLELEMENT(NAME "param", XMLATTRIBUTES('profileId' AS "name", CP_ID AS "value"))
)
)
)
);
END;
这里我试图从表中输出XMl
数据。我在XMLELEMENT
中使用XMLATTRIBUTES
,DB2
创建了相同的功能。不幸的是,我没有在MySQL中找到任何替代品。
如何在MySQL
中实现相同的程序?任何帮助或建议?