我有以下功能,工作正常。唯一的问题是它只从V_KPI_NAME
返回值BODY
。如你所见,我也传递IN_ALERT_LOGS_TIMESTAMP
,V_KPI_TPE
,但它没有返回这些值。
FUNCTION BUILD_ALERT_EMAIL_BODY
(
IN_ALERT_LOGS_TIMESTAMP IN TIMESTAMP
, IN_ALERT_LOGS_LOG_DESC IN VARCHAR2
, IN_KPI_LOG_ID IN NUMBER
) RETURN VARCHAR2 AS
BODY VARCHAR2(4000) := '';
V_KPI_DEF_ID NUMBER;
V_KPI_NAME VARCHAR2(100);
V_KPI_DESC VARCHAR2(500);
V_KPI_TYPE VARCHAR2(100);
BEGIN
-- ,'yyyy-MM-dd H24 mm ss'
Select KPI_DEF_ID INTO V_KPI_DEF_ID FROM KPI_LOGS WHERE KPI_LOG_ID = IN_KPI_LOG_ID;
Select NAME INTO V_KPI_TYPE FROM RATOR_MONITORING_CONFIGURATION.KPI_DEFINITION KD JOIN RATOR_MONITORING_CONFIGURATION.KPI_TYPE KT ON KD.KPI_TYPE = KT.KPI_TYPE_ID WHERE KD.KPI_DEF_ID = V_KPI_DEF_ID;
Select KPI_NAME INTO V_KPI_NAME FROM RATOR_MONITORING_CONFIGURATION.KPI_DEFINITION WHERE KPI_DEF_ID = V_KPI_DEF_ID;
Select KPI_DESC INTO V_KPI_DESC FROM RATOR_MONITORING_CONFIGURATION.KPI_DEFINITION WHERE KPI_DEF_ID = V_KPI_DEF_ID;
BODY := to_char(IN_ALERT_LOGS_TIMESTAMP,'DD.MM.YYYY HH24:MI') || Chr(13);
BODY := V_KPI_NAME || Chr(13) ;
BODY := V_KPI_TYPE || Chr(13) ;
RETURN BODY;
END BUILD_ALERT_EMAIL_BODY;