2016-07-05 82 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

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