1
我有下面的函數,它工作正常。唯一的問題是它只返回從BODY
的價值OF V_KPI_NAME
。正如你所看到的,我也通過IN_ALERT_LOGS_TIMESTAMP
,V_KPI_TPE
,但它沒有返回這些值。Pl/SQL函數不返回所有字段
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;
哦,它的工作,我想在每個和每個身體值之間包含分號,因爲現在我得到comdined身體值,沒有空格。 – Andrew
嗯,我相信你可以連接你需要它們的合適值! – Fudztown