Can Multiple Cursors Being Opened at the Same Time?
Submitted by: AdministratorYes, multiple cursors can be opened at the same time. See the following example:
CREATE OR REPLACE PROCEDURE ggl_CENTER AS
CURSOR emp_cur IS SELECT * FROM employees;
emp_rec employees%ROWTYPE;
CURSOR dpt_cur IS SELECT * FROM departments;
dpt_rec departments%ROWTYPE;
BEGIN
OPEN emp_cur;
OPEN dpt_cur;
FETCH emp_cur INTO emp_rec;
FETCH dpt_cur INTO dpt_rec;
DBMS_OUTPUT.PUT_LINE('Department name = ' ||
dpt_rec.department_name);
DBMS_OUTPUT.PUT_LINE('Employee name = ' ||
emp_rec.first_name || ' ' || emp_rec.last_name);
CLOSE emp_cur;
CLOSE dpt_cur;
END;
/
Department name = Administration
Employee name = Steven King
Submitted by: Administrator
CREATE OR REPLACE PROCEDURE ggl_CENTER AS
CURSOR emp_cur IS SELECT * FROM employees;
emp_rec employees%ROWTYPE;
CURSOR dpt_cur IS SELECT * FROM departments;
dpt_rec departments%ROWTYPE;
BEGIN
OPEN emp_cur;
OPEN dpt_cur;
FETCH emp_cur INTO emp_rec;
FETCH dpt_cur INTO dpt_rec;
DBMS_OUTPUT.PUT_LINE('Department name = ' ||
dpt_rec.department_name);
DBMS_OUTPUT.PUT_LINE('Employee name = ' ||
emp_rec.first_name || ' ' || emp_rec.last_name);
CLOSE emp_cur;
CLOSE dpt_cur;
END;
/
Department name = Administration
Employee name = Steven King
Submitted by: Administrator
Read Online Oracle Database Job Interview Questions And Answers
Top Oracle Database Questions
☺ | How To Write Date and Time Interval Literals in Oracle? |
☺ | What Happens to Indexes If You Drop a Table? |
☺ | What Is Input Buffer in SQL*Plus? |
☺ | How To Recover a Dropped Table in Oracle? |
☺ | What Is a Table Index in Oracle? |
Top DB Oracle Categories
☺ | Oracle PL-SQL Interview Questions. |
☺ | Oracle DBA Interview Questions. |
☺ | Oracle D2K Interview Questions. |
☺ | OCI Interview Questions. |
☺ | Oracle RMAN Interview Questions. |