If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

At the moment the UPDATE statement updates all rows of the dwsal_sales_dly table with the values provided by your subquery. If your subquery retrieves no data then the columns you are updating (ret_qty_dor, ret_trade_allow_amt_dor, ret_promo_allow_amt_dor) are set to NULL.

So if you query the dwsal_sales_dly table after the update you will find 18617 rows with NULL values for the 3 columns mentioned above.

To avoid this behaviour you have to add a WHERE clause to your update statement, excluding the rows you do not intend to change.