update other items with the same value when when the column contains Y

 
CREATE TABLE TEST 
   (     "QUATINTY" NUMBER(17,2), 
     "AMOUNT" NUMBER(17,2), 
     "ERRORRED" VARCHAR2(16 BYTE), 
     "PO" VARCHAR2(12 BYTE), 
     "LINE" VARCHAR2(10 BYTE), 
     "SEQ" VARCHAR2(14 BYTE), 
     "INVOICE" VARCHAR2(16 BYTE)
   ) 

Insert into TEST (PO,QUATINTY,AMOUNT,ERRORRED,LINE,SEQ,INVOICE) values ('123',5,50,'Y','1','1','inv1');
Insert into TEST (PO,QUATINTY,AMOUNT,ERRORRED,LINE,SEQ,INVOICE) values ('123',5,50,null,'1','2','inv1');
Insert into TEST (PO,QUATINTY,AMOUNT,ERRORRED,LINE,SEQ,INVOICE) values ('125',5,50,null,'1','1','inv2');
Insert into TEST (PO,QUATINTY,AMOUNT,ERRORRED,LINE,SEQ,INVOICE) values ('125',4,50,null,'1','2','inv2');
If you notice the table above which im trying to Edifier is updated the errorred column with 'Y' if the po and invoice are the same and have a 'Y' on the wrong column.
in other words, I should finish with "Y" in the column for INV1 errorred.
Can someone point me in the right direction, I can't for the life of me figuered it out.

Hello

Here's one way:

UPDATE     test
SET     errorred     = 'Y'
WHERE     NVL (errorred, 'N') != 'Y'
AND     (po, invoice)          IN (
                          SELECT  po, invoice
                     FROM      test
                     WHERE      errorred  = 'Y'
                           )
;

This requires that the po and invoice are not NULL. If a column can be NULL, then the solution might be a little messier, according to the results you want, but only a little. Post some sample data (with null values) which shows what types of situations, you need manage, and the results of the SAMPLES.

Tags: Database

Similar Questions

  • When I zoomed in on a website, the other tabs with the same zoom area too; is there a way to disable the page Web site global zoom?

    When I zoomed in on a website, the other tabs with the same zoom area too; is there a way to disable the page Web site global zoom?

    You can change the zoom to be specific tab instead of in-situ.

    (1) in a new tab, type or paste Subject: config in the address bar and press ENTER. Click on the button promising to be careful.

    (2) in the filter box, type or paste the zoom and make a pause so that the list is filtered

    (3) double-click the preference browser.zoom.siteSpecific from true to false.

  • I've updated for picture with the captain and when I plug in my iPhone it loads the same pictures twice each time how it stop loading the same things every day?

    I've updated for picture with the captain and when I plug in my iPhone it loads the same pictures twice each time how it stop loading the same things every day?  I tried to make the old default iphoto but picture still open when I plug in my iPhone?

    I tried to make the old default iphoto but picture still open when I plug in my iPhone?

    When the iPhone is connected and Photos opens, select iPhone in sideba of the windowr of Photos. Then, uncheck the option 'Open for this iPhone Photos' below the toolbar.  Do this for all your iPhones. The hook should be unmarked for each device individually.

  • Dvd player MediaSmart not working - when a Blu - ray Disc I'm invited to be updated, but even with the update it will not play.

    I have laptop HP Pavilion dv7-1260.  When I put in a blu - ray disc I'm propmted to get an update.  Even with the update, it will not play a blu ray.

     

    Hello

    ·         What is the update message that you receive?

    ·         Do you have an error message when you try to read the Blu - ray Disc?

    ·         This problem occurs only with Blu ray discs or any of the others?

    To play a Blu - ray disc, you must use a non-Microsoft program that supports Blu - ray playback and a device that can play Blu - ray discs.

    See the link below:

    http://Windows.Microsoft.com/en-us/Windows7/MPEG-and-DVD-video-frequently-asked-questions

  • Any way to update all items at the same time?

    Any way to update all items at the same time?

    is one by one, the only way to update?

    I have 68 articles up to 800 MB.

    Unfortunately, the team has not added an update all feature. I think that this is scheduled for February.

    If you have your folders and files properly configured with a sidecar.xml file, consider the deletion and re-creation of the folio.

  • When I click on an item with the direct Selection tool, I used to get a little place on each limit

    When I click on an item with the direct tool, I used to get a little place on each line of bounding box that I could use to adjust the size of the object. Somehow he disappeared - how can I get that back please?

    Display > display the edges

    -OB

  • How to create a new project with other page with the new version of Muse layouts?

    Hello
    If someone would continue to operate as before with the inadmissible Muse version... is - this posible to have both versions installed? or how to create a new project with other page with the new version of Muse layouts?
    Or how to download third party) 3 different configurations (desktop/tablet/mobile) under the same url with a clean result, like up yet with the Muse does not?

    Thanks for any help,

    Patrick

    Use the new version! What you want to achieve, will work! Go to the 'Page' menu and choose 'Add another Layout' and the missed buttons are in plan view.

  • SVN: #155021. You cannot update this file with the help of Dreamweaver Subversion integration because a new Subversion client application on your machine has made updates to the file Subversion meta data. For more information on this problem

    Can Hello anyone help?

    After you configure Subversion in Dreamweaver, I get this error again!

    SVN: 155021 #. You cannot update this file with the help of Dreamweaver Subversion integration because a new Subversion client application on your machine has made updates to the file Subversion meta data. For more information about this issue, see http://www.adobe.com/go/dw_svn_en.

    even after following the instructions http://www.Adobe.com/go/dw_svn_en Download the extension, python change the var in windows to say «;» C:\Python26'

    with & without quotes, with or without; before C

    command > comparability of Subversion to get the following error "the Conversion process has failed. Please make sure you have Python installed and you check Python PATH parameter'

    I managed to get all the files after the installation, I locked, unlocked and commit a file to test fact so that was all works well, the only part I'm not retrieves the latest version, this is because Subversion is 1.6.2 and dreamweaver must revert to the version 1.4.5 on local to work, the compile someone at - it an idea what to try next in order to make it work?

    Just a reminder!

    1. I configure Subversion through guidelines on http://help.Adobe.com/en_US/Dreamweaver/10.0_Using/WS80FE60AC-15F8-45a2-842E-52D29F540FED. html
    2. I managed to get the latest SVN version
    3. Lock, unlock and commit a file
    4. Installed Python in C:\Python26 change the path in windows system properties > advanced > Environment Variables > system variables > New > Python =; C:\Python26 also C:\Python26
    5. I also tried the same thing in the User Variables
    6. Installed the extension DW Subversion compatibility

    7. Tried to run the compatibly with the command > Subversion comparability in DW

    Welcome any suggestion to solve this?

    Hello

    There has been a lot of problems using svn with dw, and I know many people who have stopped trying to operate correctly.

    As much as I know dw will not work with newer versions of svn (over 1.5), and even then, there are a lot of problems, a possible solution is to try subweaver (at- http://code.google.com/p/subweaver/ ), as this has solved some of the problems associated with the use of tsvn dw environment.

    PZ

  • Updated my iPad with the new OS.

    Updated my iPad with the new OS. Initially it lights, so I have two buttons held together and finally happened. Now it is stuck on the screen with the time and will not move forward, nor is it resets. Is there any solution for this?

    Thank you

    Kat

    Try a forced reboot. Hold down the home and Sleep/Wake buttons simultaneously for about 15-20 seconds , until the Apple logo appears. You won't lose anything.

    If a force restart does not help try recovery Mode:

    https://support.Apple.com/en-us/HT201263

  • update of NULL in the column with the values of the adjacent column

    Examples of data

    with test_data as
    (select 1 as one, null as two, 2 as three,5 as four, 6 as five, null as six from dual
    union all
    select 1 as one, null as two, 2 as three,5 as four, 6 as five, null as six from dual)
    select * from test_data;
    

    This is one of those cases, the case may be where any value of a column can be null

    or two similar columns can be null. If the column is null then I want to update the adjacent column

    average value of the column, if the first column is null so I want to take the next non-null column and update, if the last column is null

    so I want to take prev not zero column and to update.

    In this case would be my expected output

    Un Two Three Four Five Six
    11.52566
    123566

    Prospects for the future the suggesion or advice.

    Or, using Analytics:

    SQL> with test_data (id, one, two, three, four, five, six) as (
      2    select 1, 1   , null, 2   , 5, 6, null  from dual union all
      3    select 2, 1   , null, 3   , 5, 6, null  from dual union all
      4    select 3, 1   , null, null, 5, 6, null  from dual union all
      5    select 4, null, null, null, 5, 6, null  from dual
      6  )
      7  select *
      8  from (
      9    select id
     10         , cell
     11         , case when next_nn is not null and prev_nn is not null
     12             then (next_nn + prev_nn)/2
     13             else nvl(next_nn, prev_nn)
     14           end val
     15    from (
     16      select id
     17           , cell
     18           , val
     19           , last_value(val) ignore nulls over(partition by id order by cell) as prev_nn
     20           , first_value(val) ignore nulls over(partition by id order by cell range between current row and unbounded following) as next_nn
     21      from test_data
     22      unpivot include nulls (val for cell in (one as 1, two as 2, three as 3, four as 4, five as 5, six as 6) )
     23    )
     24  )
     25  pivot ( min(val) for cell in (1 as "ONE", 2 as "TWO", 3 as "THREE", 4 as "FOUR", 5 as "FIVE", 6 as "SIX") )
     26  ;
    
            ID        ONE        TWO      THREE       FOUR       FIVE        SIX
    ---------- ---------- ---------- ---------- ---------- ---------- ----------
             1          1        1,5          2          5          6          6
             2          1          2          3          5          6          6
             3          1          3          3          5          6          6
             4          5          5          5          5          6          6
    
  • Project of restoring links on the other computer, with the ext hdd same source files

    I was working a project with all the source files for the project on an ext hdd. This machine in particular, then crashed and I have more access to it. data recovery after extensive (and expensive), I got the program from the old pc files and some of them include the first pro files. Is it possible to link these data, creation of a new pro, always the same machine using the ext hdd with the source files? Thank you

    That's the advantage of keeping your external media.

    Just open the project first on the new computer.  So you should not need to be reprinted media if the external drive has not changed its name from Volume and is saved as the same drive letter (PC).

    Worst case, when you open the project of the missing file dialog box will open.  Make sure to repeat others is checked and navigate to the folder / outside looking.

    Once reconnected, save the project and then...

    go and drop your auto save preferences to the external location, so you don't have to retrieve project files crashed in the future!

  • selection of the ring-control do not work. Cannot select any other item as the first item.

    Dear programmers cvi,

    I have some problems with a control ring in a panel of the CVI. the ring comprises several elements. No matter what I choose, the result will always be the first item. I can't select something else than the first (Recent not necessarily the default item).

    When I redraws the Panel, it works for the next few days. but somday in built version (production-application) the selection of ring control no longer works. When I start the uir-file in the labwindows cvi gui editor, I can understand the problem. Even in mode 'exploit' I can't select other elements than the first.

    When I convert the ring article in another ring (F11 key), and then convert back into the original it works again (1-2 days).

    When the problem appears, the contents of the file is always the same!

    I also redraw the Panel in different versions of labwindows cvi (2010/2012/2013), still the same problem.

    another ring-control on different panels (many more controls) never come whith this effect.

    all the guys there whith the same problem?

    corrupted file IUR is in the annex.

    Thank you!

    Kind regards

    Lukas roeder

    Hi Lukas.

    If you think the UI to be corrupted file, you can

    -Save in a version different (e.g. 2013 instead of 2010) and see if that makes a difference

    -Save it as a text TUI file and re - import (Options / Save in Text Format)

  • Need help to update to work with the new vSphere environment 6

    I have a great powershell script some time ago, I created to clone our production servers in a development environment and configure them for use in isolated vShield development networks.

    We have recently updated our environment vSphere vSphere 6 and changed architecture autour 5.

    Previously with vSphere 5 we had a unique vCenter server that managed our two datacenters by itself.

    With the new design of vSphere 6, we have a PSC and VCSA server to each data center in one area of SSO.

    The first thing I did with my script of cloning is up-to-date reference vcenter for a table of two servers, so I connect to two VCs at the same time.

    This allows me to see and manage the two vCenters virtual computer guests, so get - vm strives to see the comments of the source.

    However, the problem is that when I try to clone a virtual machine from one data center to another, the command fails because it can't find the virtual machine to clone.

    # Virtual Centre server or VM host to connect to
    $aryVIServer = @("vc01.domain.com", "vc02.domain.com")
    
    # Load VMware environment
    Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -InvalidCertificateAction Ignore -Confirm:$false | Out-Null
    $VIServer = Connect-VIServer $aryVIServer
    
    # Server cluster group to deploy to
    $strVMCluster = "Bubbles"
    
    # Define name of new server including environment prefix
    $vmName = "$($envPrefix)-$($CloneServer)"
    
    # Select Host with least memory consumption
    $selectedHostObj = Get-VMHost -Location $strVMCluster | Sort-Object -Property MemoryUsageGB | Select-Object -First 1
    
    # Select folder to place VM guest into
    $folderObj = Get-Datacenter -Cluster $strVMCluster | Get-Folder $selectedBubble
    
    # Select datastore with most available space
    $selectedDatastoreObj = Get-DataStore -VMHost $selectedHostObj | Sort-Object -Property FreeSpaceGB -descending | Select-Object -First 1
    
    # Clone new VM from running Server
    $newVM = New-VM -Name $vmName -VM $CloneServer -VMHost $selectedHostObj -Datastore $selectedDatastoreObj -DiskStorageFormat "Thin" -Location $folderObj -Confirm:$false
    

    He used to work very well when there was a single VC but of course does not now with two.

    So far, the only difference is the change in VCs. We always use the same exact 5.0 running ESXi hosts to the same place in separate data centers.

    Oh and I'm now using powercli 6.3 R1 instead of 5.5 R1.

    I look forward to this type of procedure should work fine, and I just need a different command for virtual machine cloning now?

    Well, I have solved the first problem according to them here:

    Re: Impossible to deploy VM model on different vCenter Server (in the same domain of SINGLE sign-on)

    However, now I can't run Invoke VMScript without getting an error that the proxy authentication is required.

    If I remove all my proxy settings in Internet Explorer, then it connects fine but this script must be run by a number of engineers without being dependent on their proxy settings are disabled.

    I can programmatically change the settings of proxy at the beginning of the script, but nothing not preventing to change those back if they use their browser and break execution of the halfway of script.

    Never had any problems with the Proxy settings before and I didn't know any other messages that have directly relevant air.

    Anyone know of a way to avoid this?

  • Last LR update multiple problems with the Canon CR2 files

    Hi team

    I need to let you know about a problem of GUI which is performing production and publishing workflows using LR after the last update of the main users.

    First LR kept crashing with Nikon nef import, it was more come with updated check & update, however the files seem to be flaky, sometimes more than 5 minutes to make the 1 / 1 or 100%, that using a MacBook Pro with the Retina display that normally does in less than a second because of the acceleration of the graphics card shows me that there must be a bug.

    You can check your code against the latest OS from Apple, as it has also been updated last week, I noticed that the preview opening on RAW with the Apple OS is slower, so it could be Apple, if you use their codecs.

    Second, I use both Nikon, Canon and Fuji Photo in RAW, The Cannon is having major issues that basically stop me to be able to make adjustments, incorrect proportions basically each function seems to pile up and stoppage of work of LR, I optimized and revived, all work on the other PC files that haven't been updated. I also noticed that when I select 6 or 8 to indicate color flags keeps the last notification of action on the screen.

    Can analyze you.

    Camera model: EOS 7 d CR2

    An example of this is that if I select the GREEN labels bar image does not reduce to show only the GREENS.

    Example 1.jpg

    Hi team

    Another updated. I solved my LR 15.2.1 problems and seems to work fine now.

    Advice for anyone with GUI main questions LR 15.2.1 running on Apple MacBook Pro retina edition 2013 with Apple El Capitan in what concerns the CR2 files. The symptoms started after the upgrade of 15.2 CC.

    OS X Symptoms: Finder related - if you have slow full resolution display in the finder, it is to say select a RAW (not jpeg) image & press SPACEBAR to preview image, if the image is about 15 to 25 MB & if it takes more than 20-30 seconds to load the full resolution with excellent clarity or you get the Gables of rendering then it's maybe that your library caches are chocked.

    Symptoms of Adobe LR: LR 15.2.1 - GUI does not, collage, inadmissible on files CR2 once the file cache has been read or changes.

    Depending on how clean your machine is ie Contact AppleCare to help you to clear the data in System & User Library Cache, then perform a HDD of first aid with OS X Utilities.

    Restart your computer, and then try again, the Finder preview my now taken 10-15 seconds to make it complete, which is normal for such a large file. Also somehow clean the cache has significantly improved the LR15.2.1 as well.

    Regarding LR 15.2.1 CR2 files read better again, and I can see updates in near real-time. Watch also the son for GPU issues performance as well, as I mine off, restarted LR & closed completely to the bottom of the laptop and rebooted again allowing the GPU box and who can to help also.

    As a result of slower Finder preview rendering, to solve this problem, I can re - install El Capitan to still solve my problems if I want, however I decided of don't not at this point, simply because of the risk & maybe needing a full hard reinstall, which mean the loss of data, and I don't want that, without making a backup first. I am happy to continue to work as it is until I had time to backup and make the full re-install, what I'll do in my local AppleStore...

    Sorry not clearly answer my own resolution or steps to follow, but one or more of them have seriously helped me today... so I hope this helps others too facing the same or similar issue

  • Update KB923789 fails with the error code 0 x 643

    Automatic update has tried several times to install an update for Flash Player (KB923789) security but it fails every time with error code 0 x 643. I am running XP Home Edition with service pack 3. Anyone with the same problem with, hopefully, a solution?

    Hi Peter Butterfield,.
     
    Download and install the update manually by visiting the following link:
     
    In addition, see:

Maybe you are looking for