ORA-01407 - update using correlated subquery
I have done a search in the SQL forum for this but could not see a case which corresponded exactly.
If the select query:
select b.description from mso_descs d, mso_att2 b where d.object_id = b.object_id and b.changed = 'D' ;
returns this result:
DESCRIPTION
--------------
11(22)33
then why does the update statement:
update mso_descs d set long_desc = (select description from mso_att2 b where d.object_id = b.object_id and b.changed = 'D') ;
return this error:
SQL Error: ORA-01407: cannot update ("ATHENA"."MSO_DESCS"."LONG_DESC") to NULL
01407. 00000 - "cannot update (%s) to NULL"
?
Perhaps I am missing something obvious but I cannot see what the difference is between the subquery in the update statement (apart from the fact it's a subquery) to the select which returns a value. Any suggestions welcome.
thanks
Edited by: user2638923 on 12-Jan-2009 09:17