Re: sqlplus update table from table

  • From: Barbara Baker <barb.baker@xxxxxxxxx>
  • To: igor.neyman@xxxxxxxxx
  • Date: Fri, 16 Apr 2010 13:57:49 -0600

thank you ALL so VERY VERY VERY VERY much!!!
I tried several things that I thought were not working, but it was because I
was mis-interpreting my update count, so I think all of the solutions would
have worked.  Here's the final update statement that I used

You are all awesome.  I can't thank you enough!!

Barb

update workorder_fact a
  set status =
     (select status from workorder_fact@repdb b
      where a.job_nbr=b.job_nbr
       and a.adj_nbr_key=b.adj_nbr_key
       and a.issue = b.issue)
where a.status='D'
and a.issue='01-APR-08'
AND EXISTS
 (select null from ad_mart.workorder_fact@repdb b
   where b.job_nbr = a.job_nbr
   and  b.adj_nbr_key = a.adj_nbr_key
   and  b.issue       = a.issue
 )




>
> On Fri, Apr 16, 2010 at 2:25 PM, Jacques Kilchoer <
> Jacques.Kilchoer@xxxxxxxxx> wrote:
>
>>  You might want to add to you where clause
>>
>>
>>
>> AND EXISTS
>>
>>  (select null from ad_mart.wof@repdb b where b.job_nbr = a.job_nbr and
>> b.adj_nbr_key = a.adj_nbr_key)
>>
>>
>>
>> because without the AND EXISTS clause you will be updating rows in A that
>> have no corresponding vlaue in B.
>>
>>
>>
>>

Other related posts: