Oracle uses implicit cursors for its internal processing. Even if we execute a SELECT statement Oracle reserves a private SQL area in memory called cursor.
We update the employee 'Mitesh' department is update to 'Program Developer'.
Example Code:
Emp Table
EMP_NO EMP_NAME EMP_DEPT EMP_SALARY 1 Amruta Web Developer 25000 2 Meena Program Developer 38000 3 MiteshWeb Developer 30000 4 Mayank Web Developer 40000
SQL>set serveroutput on SQL>edit implicit_cursor BEGIN UPDATE emp SET emp_dept='Web Developer' WHERE emp_name='Mitsh'; IF SQL%FOUND THEN dbms_output.put_line('Updated - If Found'); END IF; IF SQL%NOTFOUND THEN dbms_output.put_line('NOT Updated - If NOT Found'); END IF; IF SQL%ROWCOUNT>0 THEN dbms_output.put_line(SQL%ROWCOUNT||' Rows Updated'); ELSE dbms_output.put_line('NO Rows Updated Found'); END; / SAVE: implicit_cursor.sql
0 comments:
Post a Comment