The Oracle PL/SQL EXIT statement is used to skip the current block. It can be used to terminate loops or stop processing based on a condition you specify.
When we give EXIT statement forces a loop to complete immediately and unconditionally.
Control is then passed to the next statement (if any).
DECLARE
CURSOR EMPCUR
IS
SELECT EMPLOYEE_ID,HIRE_DATE,SUM(SALARY) sal
FROM EMPLOYEES
WHERE DEPARTMENT_ID=60
GROUP BY EMPLOYEE_ID,HIRE_DATE;
empr1 EMPCUR%rowtype;
BEGIN
OPEN EMPCUR;
LOOP
FETCH EMPCUR INTO empr1;
dbms_output.put_line(empr1.employee_id||' '||empr1.hire_date||' '||empr1.sal);
----------------------------
EXIT WHEN EMPCUR%NOTFOUND;
----------------------------
END LOOP;
CLOSE EMPCUR;
END;
/
I really liked your blog article.Really thank you! Really Cool.
ReplyDeleteOracle Data Integrator online training
Oracle Data Integrator training
Oracle DBA online training
Oracle DBA training
Oracle Enterprise Manager online training
Oracle Enterprise Manager training
Oracle Exadata online training