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: cannot update (string) to NULL

User_5OAFPNov 9 2012 — edited Nov 9 2012
I've read that one way to avoid ORA-01407 error like in this example ( [DBA-ORACLE.COM SITE|http://www.dba-oracle.com/t_ora_01407_cannot_update_string_to_null.htm] ) is to use additional EXISTS in where condition:
update ORDERS ord 
  set ord.amount = ( select ord.qty * it.item_price
                     from ITEM it
                     where ord.item_id = it.item_id )
where exists ( select 1
               from ITEM it 
               where ord.item_id = it.item_id );
Execution plan confirms that those similar correlated subqueries are evaluated twice when I substitute 1 with select ord.qty * it.item_price to make them identical. what will happen if between those two evaluations for particular item_id if some commited update/delete happens on ITEM table causing row removal/values change for item_id? How will it influence the UPDATe? will there be any errors etc?

thank you
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 7 2012
Added on Nov 9 2012
4 comments
1,610 views