Collections:
Open Multiple Cursors at the Same Time in Oracle
Can Multiple Cursors Being Opened at the Same Time in Oracle?
✍: FYIcenter.com
Yes, multiple cursors can be opened at the same time. See the following example:
CREATE OR REPLACE PROCEDURE FYI_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
⇒ Pass a Parameter to a Cursor in Oracle
⇐ Use an Explicit Cursor without OPEN Statements in Oracle
2018-04-07, 3687🔥, 0💬
Popular Posts:
How To Create a Dynamic Cursor with the DYNAMIC Option in SQL Server Transact-SQL? If the underlying...
Collections: Interview Questions MySQL Tutorials MySQL Functions Oracle Tutorials SQL Server Tutoria...
What Are Date and Time Functions in MySQL? MySQL offers a number of functions for date and time valu...
How To Convert a Unicode Strings to Non-Unicode Strings in SQL Server Transact-SQL? Since Unicode ch...
Where to find answers to frequently asked questions on INSERT, UPDATE and DELETE Statements in MySQL...