Kayshav.com
About Developer Oracle 11g Technology Information Sitemap

PL/SQL - Continue

SET SERVEROUTPUT ON;

DECLARE
 CURSOR c_cont IS
  SELECT  level idx
  FROM  DUAL
  CONNECT BY level <= 6;

  v_dr    SIMPLE_INTEGER := 0;
  v_val   NUMBER(12,4);
BEGIN
 
  FOR c_rec IN c_cont LOOP

    DBMS_OUTPUT.PUT_LINE('Index [idx] = '||c_rec.idx);

    IF c_rec.idx = 2 THEN

       v_val := c_rec.idx;
       DBMS_OUTPUT.PUT_LINE('v_val = '||c_rec.idx);
       
    END IF;

    IF c_rec.idx = 4 THEN

       BEGIN
         v_val := c_rec.idx/v_dr;
         DBMS_OUTPUT.PUT_LINE('v_val = '||v_val);

       EXCEPTION 
        WHEN OTHERS THEN
          DBMS_OUTPUT.PUT_LINE('Error = '||SQLERRM);
          CONTINUE;                                   --Should be within loop 
       END;

    END IF;

    IF c_rec.idx = 5 THEN

       v_val := ROUND(c_rec.idx/(c_rec.idx-1),4);
       DBMS_OUTPUT.PUT_LINE('v_val = '||v_val);

    END IF;
  END LOOP;

EXCEPTION
 WHEN OTHERS THEN
  NULL;            -- Just for test/POC
END;
/


Example 2

Example 3

Oracle 11gXEr2 - Index

Oracle registered trademark of Oracle Corporation.

Last Revised On: October 15th, 2014

  292