Collections:
Error: Exact Fetch Returns More Rows in Oracle
Can You Assign Multiple Query Result Rows To a Variable in Oracle?
✍: FYIcenter.com
You can use "SELECT ... INTO variable" to assign query results to variables. But what happens if the SELECT statements return multiple rows? The answer is that you will get a run time error. The following tutorial exercise shows this error condition:
DECLARE fname VARCHAR2(10); lname VARCHAR2(10); BEGIN SELECT first_name, last_name INTO fname, lname FROM employees WHERE employee_id = 100; DBMS_OUTPUT.PUT_LINE('Name = ' || fname || ' ' || lname); SELECT first_name, last_name INTO fname, lname FROM employees WHERE employee_id > 100; DBMS_OUTPUT.PUT_LINE('Name = ' || fname || ' ' || lname); END; / ORA-01422: exact fetch returns more than requested number of rows ORA-06512: at line 8 Name = Steven King
2018-09-24, 992👍, 0💬
Popular Posts:
Where to find tutorials to answer some frequently asked questions on Microsoft SQL Server Transact-S...
How To Calculate DATETIME Value Differences Using the DATEDIFF() Function in SQL Server Transact-SQL...
How To List All Login Names on the Server in SQL Server? If you want to see a list of all login name...
How Can Windows Applications Connect to Oracle Servers in Oracle? A Windows application can connect ...
How Can Windows Applications Connect to Oracle Servers in Oracle? A Windows application can connect ...