title: Can I declare a CURSOR after BEGIN statement of trigger in Oracle?
body: <p>I need to create a CURSOR after BEGIN statement in a trigger based on a condition like this:</p>
  
  <pre><code>IF :OLD.DWF_STATUS = 'P' AND :NEW.DWF_STATUS = 'C' THEN
  
      DECLARE CURSOR cur_list IS
          SELECT DISTINCT DR_PRJ_ID, STR_EMAIL, DWFU_US_ID
          FROM DOC_WORKFLOW JOIN DOC_WF_USERS ON DWFU_DWF_ID = DWF_ID
          JOIN DOCUMENT_REF ON DWF_DR_ID = DR_ID AND DR_TYPE = 'P'
          LEFT OUTER JOIN ST_REGISTER ON STR_ID = DWFU_STR_ID
          WHERE DWF_ID = :NEW.DWF_ID;
  
  END IF;
  </code></pre>
  
  <p>When I compile, I get this error:</p>
  
  <blockquote>
    <p>Error(99,5): PLS-00103: Encountered the symbol "END" when expecting one of the following:<br>
       begin function pragma procedure subtype type <br>
       current cursor delete  exists prior</p>
  </blockquote>
  
  <p>How can I declare cursor after BEGIN statement of trigger in Oracle?</p>