1 SQL error ORA 01427 - wikitechy.com

[Fix]-SQL error ORA 01427

Wikitechy | 1905 Views | oracle | 26 May 2016

 

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.



Workshop

Bug Bounty
Webinar

Join our Community

Advertise
<