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;
/
0 comments:
Post a Comment
Thank you for your comments we will get back to soon