我需要在此PL / SQL CODE中传递数组值动态但是数组只看到第一个值代码:提示(代码很大,所以我在问题部分切割它)请
如果您需要更多信息请问我,这是我尝试将其传递给动态。
可变填充代码:
FOR ET IN (SELECT EMAIL
FROM XX_INTERCO_SYS_CON
WHERE ACC_NO = Q.ACC_NO AND TYPE = 'TO')
LOOP
IF P_TO IS NOT NULL
THEN
P_TO := P_TO || ',''' || ET.EMAIL||'''';
ELSE
P_TO := ''''||ET.EMAIL||'''';
END IF;
END LOOP;
FOR EC IN (SELECT EMAIL
FROM XX_INTERCO_SYS_CON
WHERE ACC_NO = Q.ACC_NO AND TYPE = 'CC')
LOOP
IF P_CC IS NOT NULL
THEN
P_CC := P_CC || ',''' || EC.EMAIL||'''';
ELSE
P_CC := ''''||EC.EMAIL||'''';
END IF;
END LOOP;
数组填充部分:
XX_MAIL_PKG.SEND (P_FROM => P_FROM,
P_TO => XX_MAIL_PKG.ARRAY ( P_TO),
P_CC => XX_MAIL_PKG.ARRAY (P_CC),
P_SUBJECT => 'test',
P_HTML_MSG => P_HTML_OUTPUT,
P_SMTP_HOST => P_SMTP_HOST,
P_SMTP_PORT => P_SMTP_PORT,
P_TEXT_MSG => NULL,
X_ERR_MSG => X_ERR_MSG);
COMMIT;
DBMS_OUTPUT.PUT_LINE (X_ERR_MSG);
答案 0 :(得分:0)
您似乎正在使用集合 - 所以(不知道XX_MAIL_PKG
包中的内容)您可以尝试这样做:
DECLARE
V_TO XX_MAIL_PKG.ARRAY;
V_CC XX_MAIL_PKG.ARRAY;
BEGIN
SELECT EMAIL
BULK COLLECT INTO V_TO
FROM XX_INTERCO_SYS_CON
WHERE ACC_NO = Q.ACC_NO AND TYPE = 'TO';
SELECT EMAIL
BULK COLLECT INTO V_CC
FROM XX_INTERCO_SYS_CON
WHERE ACC_NO = Q.ACC_NO AND TYPE = 'CC';
XX_MAIL_PKG.SEND (P_FROM => P_FROM,
P_TO => V_TO,
P_CC => V_CC,
P_SUBJECT => 'test',
P_HTML_MSG => P_HTML_OUTPUT,
P_SMTP_HOST => P_SMTP_HOST,
P_SMTP_PORT => P_SMTP_PORT,
P_TEXT_MSG => NULL,
X_ERR_MSG => X_ERR_MSG);
COMMIT;
DBMS_OUTPUT.PUT_LINE (X_ERR_MSG);
END;
/