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, 2865🔥, 0💬
Popular Posts:
What are binary literals supported in SQL Server Transact-SQL? Binary literals in Transact-SQL are s...
Where to find answers to frequently asked questions on Managing Security, Login and User in SQL Serv...
How To Install Oracle Database 10g XE in Oracle? To install 10g universal edition, double click, Ora...
How To Start the Command-Line SQL*Plus in Oracle? If you Oracle server or client installed on your w...
What Happens to Your Transactions When ERROR 1205 Occurred in MySQL? If your transaction receives th...