2016-07-05 16 views
-1

這裏的代碼似乎沒問題。 獲得例外PLS-00103似乎是正確的獲得例外PLS-00103,似乎是正確的

這裏的代碼似乎沒問題。 PLS-00103和似乎是正確的

DECLARE 

l_body varchar2(5000); 
l_body_html varchar2(5000); 
l_workspace_id number; 
DiscontinuationEmail varchar2(5000); 
DiscontinuationSubject varchar2(5000); 
Discontinuation varchar2(5000); 
DiscontinuationCC varchar2(5000); 
DiscontinuationReminder number; 

cursor cDiscontinuation is select NETSEC_TEAM.ENGINEER_EMAIL as ENGINEER_EMAIL, 
    NETSEC_TEAM.NETSEC_MGR as NETSEC_MGR 
from NETSEC_TEAM NETSEC_TEAM 
Where NETSEC_TEAM.NETSEC_MGR <> 'ALL' 
MINUS 
select NETSEC_PROCOMPLIANCE_1.EMPLOYEE_EMAIL as EMPLOYEE_EMAIL, 
NETSEC_PROCOMPLIANCE_1.MANAGER_EMAIL as MANAGER_EMAIL 
from NETSEC_PROCOMPLIANCE_1 NETSEC_PROCOMPLIANCE_1 
Where NETSEC_PROCOMPLIANCE_1.DOCUMENT_NAME ='Discontinuation of Daily BI Agent Reports'; 
    -- ****   
    DOD cDiscontinuation%rowtype; 

BEGIN 
    l_workspace_id := apex_util.find_security_group_id (p_workspace => 'CIT-CSCOE-PROD'); 
apex_util.set_security_group_id (p_security_group_id => l_workspace_id);   

    /* *********** Discontinuation ********************** */  

OPEN cDiscontinuation 
Discontinuation :=''; 
DiscontinuationCC :=''; 
DiscontinuationReminder := 1; 

SELECT REMINDER INTO DiscontinuationReminder 
FROM NETSEC_COMPLIANCE_REMINDER WHERE COMPLIANT ='Discontinuation'; 

Loop 
FETCH cDiscontinuation INTO DOD; 
EXIT WHEN cDiscontinuation%NOTFOUND; 
     Discontinuation := Discontinuation || ','|| DOD.ENGINEER_EMAIL; 
     DiscontinuationCC := DiscontinuationCC || ','|| DOD.NETSEC_MGR; 
END LOOP; 
UPDATE NETSEC_COMPLIANCE_REMINDER SET REMINDER = DiscontinuationReminder+1 
WHERE COMPLIANT ='Discontinuation'; 
DiscontinuationReminder := DiscontinuationReminder + 1; 

CLOSE cDiscontinuation; 

DiscontinuationEmail:='TO: '|| Discontinuation ||' <br><br> CC: ' || DiscontinuationCC ||' 

<p>If you are a "To:" recipient of this email, it means that you are not in compliance with the following Network Services team announcement:<br /> 
If you are a "Cc:" recipient of this email, it means that one or more of your employees are not in compliance with the following Network Services team announcement:</p> 

<p><a href="https://apex.oraclecorp.com/pls/apex/f?p=1648:522">Discontinuation of Daily BI Agent Reports</a></p> 

<p>Please click on the link above and acknowledge and confirm your understanding of the process.</p> 

<p>Thank you.</p>'; 

Discontinuation:= '***** NON-COMPLIANT ***** Discontinuation of Daily BI Agent Reports- RELEASE DATE 25 MAY 2016';  

    apex_mail.send(
    p_to  => '[email protected]', 
    p_from  => '[email protected]', 
    p_cc  => '', 
    p_body  => DiscontinuationSubject, 
    p_body_html => DiscontinuationEmail, 
    p_subj  => 'REMINDER #'|| DiscontinuationReminder || ' ' || DiscontinuationSubject, 
     p_bcc => '', 
     p_replyto => NULL 
    );  
END; 
+0

,請複製粘貼你得到確切的錯誤。 –

+0

ORA-06550:第34行,第5列: PLS-00103:在期待以下某項時遇到符號「DISCONTINUATION」: 。 (%;對於 符號 「;」 被取代 「停藥」 繼續 1. DECLARE 2. 3. l_body VARCHAR2(5000); 4. VARCHAR2 l_body_html(5000); 5. l_workspace_id號碼; –

回答

0

你錯過款式後

OPEN cDiscontinuation 

只是一個評論分號:有沒有爲什麼你分離的開啓從讀取的任何原因?你也可以使用CURSOR FOR LOOP - 只是稍微清理一下代碼。因此,而不是:

OPEN cDiscontinuation 
LOOP 
FETCH cDiscontinuation INTO DOD; 
EXIT WHEN cDiscontinuation%NOTFOUND; 
     Discontinuation := Discontinuation || ','|| DOD.ENGINEER_EMAIL; 
     DiscontinuationCC := DiscontinuationCC || ','|| DOD.NETSEC_MGR; 
END LOOP; 

你可以編寫

FOR R_discontinuation IN cDiscontinuation LOOP 
    Discontinuation := Discontinuation || ','|| R_discontinuation.ENGINEER_EMAIL; 
    DiscontinuationCC := DiscontinuationCC || ','|| R_discontinuation.NETSEC_MGR; 
END LOOP ; 

在這種情況下R_discontinuation是完全等同於國防部在第一個例子(即cDiscontinuation%ROWTYPE),但隱式聲明。

使用for循環CURSOR不再正確的,你的做法,只是清潔

+0

謝謝基督徒,那是錯誤 –

+0

關於你的評論...這是怎麼回事?我不明白你可以給我一個例子嗎? –

+0

謝謝基督教:)我明白了:) –

相關問題