[Fix]-SQL error ORA 01427
An update is initiated on a column in a table by collecting the values from another table in the data store using the below query:
UPDATE tablename PT
SET DID = (select distinct(did) from datastore.get_dept_alias
where upper(ltrim(rtrim(deptalias))) = upper(ltrim(rtrim(PT."Dept Descr")))
AND cid = PT.CID)
Note:
Both the column names in the table are the same as entered I get ORA 01427 error.
Reason for the error:
ORA-01427 error code means single-row subquery returns more than one row.
Fix:
Modify the subquery to return exactly one row at a time.