Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-01407 - update using correlated subquery

user2638923Jan 12 2009 — edited Jan 12 2009
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 9 2009
Added on Jan 12 2009
9 comments
4,170 views