Re: sqlplus update table from table

From: Igor Neyman <igor.neyman_at_gmail.com>
Date: Fri, 16 Apr 2010 14:17:58 -0400
Message-ID: <z2udede63361004161117kbe2a35bchc4e1ef4c60f54eb5_at_mail.gmail.com>



Sorry,

missed:

AND b.issue = a.issue

condition, as in:

UPDATE ad_mart.wof a
  SET a.status = (

                 SELECT b.status
                   FROM ad_mart.wof_at_repdb b
                   WHERE b.job_nbr = a.job_nbr
                    AND  b.adj_nbr_key = a.adj_nbr_key
                    AND b.issue = a.issue)
  WHERE a.issue = b.issue

  and a.issue = '01-APR-08'
  and a.status='D'
/

Igor Neyman

On Fri, Apr 16, 2010 at 2:07 PM, Igor Neyman <igor.neyman_at_gmail.com> wrote:

> Barbara,
>
> Try this:
>
> UPDATE ad_mart.wof a
> SET a.status = (
> SELECT b.status
> FROM ad_mart.wof_at_repdb b
> WHERE b.job_nbr = a.job_nbr
> AND b.adj_nbr_key = a.adj_nbr_key)
> WHERE a.issue = b.issue
>
> and a.issue = '01-APR-08'
> and a.status='D'
> /
>
> Igor Neyman
>
>
> On Fri, Apr 16, 2010 at 1:46 PM, Barbara Baker <barb.baker_at_gmail.com>wrote:
>
>> hi, all.
>> oracle 9.2.0.7, linux
>>
>> I have identical tables in 2 databases (dwprod and repdb)
>>
>> I want to update column STATUS in table wof in database dwprod
>>
>> to be equal to STATUS in table wof in database repdb
>>
>> (using a database link)
>>
>> when the status in dwprod is ‘D’
>>
>> and the date and keys are equal and the date is april 1 2008
>>
>>
>>
>> I’ve tried a bunch of In’s Where’s Minuses, etc, but I’m not getting it.
>>
>>
>>
>> Any ideas?
>>
>> Thanks SO MUCH.
>>
>> Barb
>>
>>
>>
>> update ad_mart.wof a
>>
>> set a.status = b.status
>>
>> where (a.job_nbr,a.adj_nbr_key,a.issue)
>>
>> IN
>>
>> (select
>>
>> job_nbr,adj_nbr_key,issue
>>
>> from ad_mart.wof a ,
>>
>> ad_mart.wof_at_repdb b
>>
>> where
>>
>> ( a.job_nbr = b.job_nbr
>>
>> and a.adj_nbr_key = b.adj_nbr_key
>>
>> and a.issue = b.issue
>>
>> and a.issue = '01-APR-08'
>>
>> and a.status='D')
>>
>> )
>>
>> /
>>
>>
>>
>>
>>
>>
>>
>>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Apr 16 2010 - 13:17:58 CDT

Original text of this message