title: Need to put TRY - CATCH in oracle stored procedure
body: <p>I have created SP for creating <code>unique index</code> on multiple tables.</p>
  
  <p>Now i need to create Try-catch (exception handling) for this, like incase index not created this should be catch .... </p>
  
  <p>For example i have 200 tables and only 1 tables is giving error, Then 199 tables should be created with index and catch log have that one error-ed tables name.</p>
  
  <p>Please help .</p>
  
  <pre><code>DECLARE
  CURSOR C_TABLE IS
  SELECT INPUT_TABLE,HISTORY_TABLE FROM FUNCTIONS WHERE TARGET_SYS IN ('ABC','DEC') AND ACTIVE_FLAG='Y';
  
  SQL_CREATE_INX VARCHAR2(200);
  SQL_TABLE_NAME VARCHAR2(200);
  
  BEGIN
  -- INPUT TABLE
      FOR I IN C_TABLE
      LOOP
  
          SQL_CREATE_INX:='CREATE UNIQUE INDEX CLM1.AUDIT_SUB_SITE_INX ON '||I.INPUT_TABLE||' (AUDIT_NBR , SUB_AUDIT_NBR , STATE) ';
          SQL_TABLE_NAME:=I.INPUT_TABLE;
          EXECUTE IMMEDIATE SQL_CREATE_INX;
  
          DBMS_OUTPUT.PUT_LINE('INDEX DONE : '||SQL_TABLE_NAME);
  
      END LOOP;
      DBMS_OUTPUT.PUT_LINE('INDEXES CREATED FOR ALL INPUT TABLES');
  
      -- OUTPUT TABLE
      FOR H IN C_TABLE
      LOOP
  
          SQL_CREATE_INX:='CREATE UNIQUE INDEX CLM1.AUDIT_SUB_SITE_INX ON '||H.HISTORY_TABLE||' (AUDIT_NBR , SUB_AUDIT_NBR , STATE)  ';
          SQL_TABLE_NAME:=H.HISTORY_TABLE;
          EXECUTE IMMEDIATE SQL_CREATE_INX;
  
          DBMS_OUTPUT.PUT_LINE('INDEX DONE : '||SQL_TABLE_NAME);
  
      END LOOP;
      DBMS_OUTPUT.PUT_LINE('INDEXES CREATED FOR ALL OUTPUT TABLES');
  
  
  END;
  </code></pre>