Collections:
Loop through the Implicit Cursor in Oracle
How To Loop through Data Rows in the Implicit Curosr in Oracle?
✍: FYIcenter.com
You use the FOR ... IN ... LOOP statement to loop through data rows in the implicit cursor as the following syntax:
FOR row IN dml_statement LOOP
(statement block with row.field)
END LOOP;
Here "row" is a local RECORD type variable with fields automatically defined to match the fields in the data rows resulted from the DML statement. Here is a good tutorial exercise on loop through data rows with the implicit cursor:
BEGIN
FOR row IN (SELECT * FROM employees
WHERE manager_id = 101) LOOP
DBMS_OUTPUT.PUT_LINE('Name = ' || row.last_name);
END LOOP;
END;
/
Name = Greenberg
Name = Whalen
Name = Mavris
Name = Baer
Name = Higgins
⇒ Define an Explicit Cursor in Oracle
⇐ Attributes of the Implicit Cursor in Oracle
2018-07-22, 3174🔥, 0💬
Popular Posts:
How To Calculate Age in Days, Hours and Minutes in SQL Server Transact-SQL? On many Web sites, news ...
What Happens to an Arithmetic Operation with Two Different Data Types in SQL Server Transact-SQL? Wh...
How To Get Year, Month and Day Out of DATETIME Values in SQL Server Transact-SQL? You can use DATEPA...
How To Break Query Output into Pages in MySQL? If you have a query that returns hundreds of rows, an...
How To Look at the Current SQL*Plus System Settings in Oracle? If you want to see the current values...