I have an update statement, at first it worked with some data, but after a while I've been having issues with some regiters , I got the following error: ORA-01427: single-row subquery returns more than one row . I thought it was the IN because the query might return repeated IDs, so I put a DISTINCT but I kept getting the same error, does anyone have any idea what could it be?
The query below:
UPDATE
TABLE_DETAIL DET
SET
DET.ACCEPTED=?,
DET.VALUE_ACCEPTED=(SELECT RES.VALUE FROM TABLE_RES RES WHERE RES.MYT=DET.MYT AND RES.RAD=DET.RAD AND RES.ITEM=DET.ITEM),
WHERE
DET.ID
IN (
SELECT
DISTINCT DET_I.ID
FROM TABLE_DETAIL DET_I, TABLE_RES RES_I, TABLE_REC REC
WHERE
DET_I.MYT = ?
AND
REC.TEMP
NOT IN (
SELECT DISTINCT TEMP
FROM
TABLE_IMAGES WHERE CODE=?)
AND RES_I.USER = ?
)
DET.VALUE_ACCEPTED=(SELECT RES.VALUE FROM...
sub-query that causes trouble. – jarlh