Oracle explicit cursors are a type of important cursors. The following describes the usage of Oracle explicit cursors in detail. We hope you can learn more about Oracle explicit cursors.
Oracle explicit cursor:
Oracle explicit cursor Definition Format:
CURSOR name (parameter) [Return Value Type] IS
Select statement
Example
- set serveroutput on
-
- declare
-
- cursor emp_cur ( p_deptid in number) is
-
- select * from employees where department_id = p_deptid;
-
- l_emp employees%rowtype;
-
- begin
-
- dbms_output.put_line('Getting employees from department 30');
-
- open emp_cur(30);
-
- loop
-
- fetch emp_cur into l_emp;
-
- exit when emp_cur%notfound;
-
- dbms_output.put_line('Employee id '|| l_emp.employee_id || ' is ');
-
- dbms_output.put_line(l_emp.first_name || ' ' || l_emp.last_name);
-
- end loop;
-
- close emp_cur;
-
- dbms_output.put_line('Getting employees from department 90');
-
- open emp_cur(90);
-
- loop
-
- fetch emp_cur into l_emp;
-
- exit when emp_cur%notfound;
-
- dbms_output.put_line('Employee id '|| l_emp.employee_id || ' is ');
-
- dbms_output.put_line(l_emp.first_name || ' ' || l_emp.last_name);
-
- end loop;
-
- close emp_cur;
-
- end;
-
- /
Use instances of Oracle stored procedures
Oracle command line custom editor vi
Implementation of oracle command line Logon
How to add tablespaces in ORACLE
Syntax for creating views in Oracle