Can I combine these updates?

Hello

I was wondering if there was a way to combine the two instructions of update below in a single statement?

Basically, the motions are the same, but I just want to update the column with a different value depending on the value of t2.name
UPDATE mydetails
SET    col1= decode(col1, null, null, 1)
WHERE  (col2, col3) in                              
(
      SELECT      
           t3.value
          ,t3.id 
      FROM    
           t1     
          ,t2             
          ,t3    
      WHERE   
          t1.id     = t2.id
      AND t1.id  = t3.id 
      AND     t2.Name          <> 'NOENTRY'        
);      


UPDATE mydetails
SET    col1= decode(col1, null, null, 999)
WHERE  (col2, col3) in                              
(
      SELECT      
           t3.value
          ,t3.id 
      FROM    
           t1     
          ,t2             
          ,t3    
      WHERE   
          t1.id     = t2.id
      AND t1.id  = t3.id 
      AND     t2.Name          = 'VERIFIED'        
);
Thank you very much.

Published by: skulls on July 13, 2010 21:43, copy and paste error

! = means even at-<\>.

merge mydetails a
using(SELECT
         t3.value
        ,t3.id ,t2.Name
     FROM
         t1
        ,t2
        ,t3
     WHERE
        t1.id   = t2.id
     AND t1.id  = t3.id
     AND    t2.Name !='NOENTRY') b
on (a.col2=b.value and a.col3=b.id)
when matched then
update set a.col1 = case when b.Name = 'VERIFIED'
                         then nvl2(a.col1,999,null)
                         else nvl2(a.col1,1  ,null) end;

Tags: Database

Similar Questions

Maybe you are looking for

  • Problems USB HDD - FW6.4.0 related to the recent update?

    I have a RN102 - 2 x 2 TB disks. In recent days, I had trouble with my backups to break USB hdds - many that I share, try to solve the problem. I'm not at the point where the RN102 usually will not start right when a USB drive is attached, and if I g

  • 2 updates repeatedly being installed

    Hi, kb954430 and kb973688 updates are repeatedly be downloaded and installed. They had initially been installed on my pc for some time now. I restarted the pc, to see if he would address the problem. Don't know how to deal with this. Windows 7 is on

  • Bing Bar 7.0 (KB2626808) was not installed

    I have WIndows XP SP3.  When the Windows automatic update is enabled, it is not able to install Bing Bar 7.0.  Can you help me?

  • Home networking issues

    OK, here's the problem. I networked my 3 computers together; 1 home, 1 vista home, 1 7 home xp. The XP tells me in my network places connections and 2 other computers through the internet. It has 2 categories showing the local network and internet. W

  • HP Pavilion dv6 keyboard works not properly

    Hello I use a HP Pavilion dv6 laptop running Windows 7 for about a year and a half.  Recently (I can't say exactly when) I noticed that my keyboard does not work properly.  There is nothing huge, but sometimes I have to push a button twice before she