Collections:
Use an Explicit Cursor without OPEN Statements in Oracle
How To Use an Explicit Cursor without OPEN Statements in Oracle?
✍: FYIcenter.com
If you want to open a cursor and loop through its data rows in quick way, you can use the FOR ... IN ... LOOP statement in the same way as the implicit cursor. The following tutorial exercise gives you a good example:
CREATE OR REPLACE PROCEDURE FYI_CENTER AS
CURSOR emp_cur IS SELECT * FROM employees
WHERE manager_id = 101;
BEGIN
FOR row IN emp_cur LOOP
DBMS_OUTPUT.PUT_LINE('Name = ' ||
row.first_name || ' ' || row.last_name);
END LOOP;
END;
/
Name = Nancy Greenberg
Name = Jennifer Whalen
Name = Susan Mavris
Name = Hermann Baer
Name = Shelley Higgins
⇒ Open Multiple Cursors at the Same Time in Oracle
⇐ Use FETCH Statement in a Loop in Oracle
2018-04-07, 2605🔥, 0💬
Popular Posts:
How To Use DATEADD() Function in SQL Server Transact-SQL? DATEADD() is a very useful function for ma...
How to obtain the number of rows found by the last SELECT statement using the FOUND_ROWS() function?...
How To View Data Files in the Current Database in Oracle? If you want to get a list of all tablespac...
How To Calculate DATETIME Value Differences Using the DATEDIFF() Function in SQL Server Transact-SQL...
How To Use GO Command in "sqlcmd" in SQL Server? "sqlcmd" is a command line client application to ru...