What Happens If the UPDATE Subquery Returns Multiple Rows?
Submitted by: AdministratorIf a subquery is used in a UPDATE statement, it must return exactly one row for each row in the update table that matches the WHERE clause. If it returns multiple rows, Oracle server will give you an error message. To test this out, you can try the following tutorial exercise:
UPDATE ggl_links SET (notes, created) =
(SELECT last_name, hire_date FROM employees
WHERE employee_id < id)
WHERE id < 110;
ERROR at line 1:
ORA-01427: single-row subquery returns more than one row
The problem is the criteria in the subquery: "employee_id < id"
Submitted by: Administrator
UPDATE ggl_links SET (notes, created) =
(SELECT last_name, hire_date FROM employees
WHERE employee_id < id)
WHERE id < 110;
ERROR at line 1:
ORA-01427: single-row subquery returns more than one row
The problem is the criteria in the subquery: "employee_id < id"
Submitted by: Administrator
Read Online Oracle Database Job Interview Questions And Answers
Top Oracle Database Questions
☺ | How To Write Date and Time Interval Literals in Oracle? |
☺ | How To Use Values from Other Tables in UPDATE Statements using Oracle? |
☺ | What Is Input Buffer in SQL*Plus? |
☺ | How Run SQL*Plus Commands That Are Stored in a Local File? |
☺ | How To Create a New Table in Oracle? |
Top DB Oracle Categories
☺ | Oracle PL-SQL Interview Questions. |
☺ | Oracle DBA Interview Questions. |
☺ | Oracle D2K Interview Questions. |
☺ | OCI Interview Questions. |
☺ | Forms Reports Interview Questions. |