Collections:
Process Query Result in PL/SQL in Oracle
How To Process Query Result in PL/SQL in Oracle?
✍: FYIcenter.com
You can run queries (SELECT statements) in a PL/SQL code blocks, and process the results a loop as shown in the following script example:
SQL> set serveroutput on;
SQL> BEGIN
2 FOR row IN
3 (SELECT * FROM employees WHERE manager_id = 101)
4 LOOP
5 DBMS_OUTPUT.PUT_LINE('Name = ' || row.last_name);
6 END LOOP;
7 END;
8 /
Name = Greenberg
Name = Whalen
Name = Mavris
Name = Baer
Name = Higgins
The loop statement in this script automatically sets a temporary variable "row" each row in the result set returned from the SELECT statement.
⇒ Create an Array in PL/SQL in Oracle
⇐ Use SQL Statements in PL/SQL in Oracle
2019-03-08, 2603🔥, 0💬
Popular Posts:
How to change the data type of an existing column with "ALTER TABLE" statements in SQL Server? Somet...
How To Divide Query Output into Multiple Groups with the GROUP BY Clause in SQL Server? Sometimes, y...
How To Start Instance with a Minimal Initialization Parameter File in Oracle? The sample initializat...
How To View Data Files in the Current Database in Oracle? If you want to get a list of all tablespac...
What To Do If the StartDB.bat Failed to Start the XE Instance in Oracle? If StartDB.bat failed to st...