What do you expect the database to return if it found two rows in the second table that matches the current row? And also these values are different??? (so they are not filtered out by DISTINCT?
Take the first one or the second one? Concatenate data of first and second one and then store?
I mean you must make your "where" clause in a way that exactly one record of source table matches exactly one record (or none) in destination table.
You can do that by making sure the matching keys PRT.PARTNER_CD = STL.PARTNER_CD are unique in both tables. Or filter out more inside your where clause, by matching with a second column.
Or matching with min(rownum) to get the first record.
Hi,
I need to Copy all values of a column from one table to another. Below are the details:
Source: STL_GRP table, VEND column
Destination PARTNER table, VEND column.
I am using the below query which is incorrect:
UPDATE PARTNER
SET VEND=
(
SELECT DISTINCT STL.VEND
FROM STL_GRP STL, PARTNER PRT
WHERE PRT.PARTNER_CD = STL.PARTNER_CD
)
This query is returning error: "ORA-01427: single-row subquery returns more than one row", which is true.
Can someone suggest an alternative to do this? Any help will be appreciated. Thanks.