-1

ここのコードは問題ないようです。この例外が発生しています:(私を修正してください。例外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        => 'bernardo.troncoso@oracle.com',
     p_from      => 'bernardo.troncoso@oracle.com',
     p_cc        => '',
     p_body      => DiscontinuationSubject,
     p_body_html => DiscontinuationEmail,
     p_subj      => 'REMINDER #'|| DiscontinuationReminder || ' ' || DiscontinuationSubject,
      p_bcc => '',
      p_replyto => NULL
     );    
END;
4

1 に答える 1

0

後にセミコロンがありません

OPEN cDiscontinuation

スタイルに関するコメント: OPEN を FETCH から分離した理由はありますか? 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) の DOD とまったく同じですが、暗黙的に宣言されています。

CURSOR FOR LOOP を使用することは、あなたのアプローチよりも正確ではなく、よりクリーンです

于 2016-07-05T07:03:57.937 に答える