Update at least a record where there are relationship

Hi I have a situation where I have two tables, the thing that I have what it takes at least update a record where there are relationship for example I Organization table and table organisation_user

If I have some relationship between this two table I have to malke column status = 'Active' in the table of organization

something like that

Update uam_organisations set registration_status = "A".

where UAM_ORGANISATIONS.ORGANISATIONID = UAM_ORGANISATION_USER.ORGANISATIONID

Another screenplay

I have two tables organisation_user, adminstatus

I what to do at least one user to be admin, I have 3 reviews in UAM_ORGANISATION_USER, but at least one user must be administrator

Like this

Update uam_organisation_user set ASSOCSTATCODE = "ADMIN".

WHERE UAM_ORGANISATION_USER.ORGANISATIONID IS NOT NULL AT LEAST ONE USER MUST BE AN ADMINISTRATOR

First condition:

Update uam_organisations the RegistrationStatus value which is EQUAL = 'A'

where ORGANISATIONID in (select ORGANISATIONID from UAM_ORGANISATION_USER)

and REGISTRATIONSTATUS! = « A » ;

Second requirement:

Update UAM_ORGANISATION_USER

Set assocstatcode = "ADMIN".

where rowid in)

Select get rid of)

Select the rowid RID.

Sum (decode (assocstatcode, 'ADMIN', 1, 0)) on admin_count (organisationid score),

ROW_NUMBER() on rn (partition in order of organisationid by the user name)

of UAM_ORGANISATION_USER

where ORGANISATIONID is not null

)

where admin_count = 0 and rn = 1

);

Tags: Database

Similar Questions

  • Unable to install the update. Please make sure that there are no other instances...

    Windows 7. I am the only user and administrator.
    Every time I start Firefox I get the "the update could not be installed. Please make sure that you don't have any other instances of firefox... etc. ".
    The Task Manager shows all instances of firefox are closed, processes and applications.
    It happens even after restarting Windows 7
    Help on Firefox reports that I'm on 20.0.1 "you are currently on the OUTPUT channel.

    There is a box "Turn to update". When you click on it, Firefox will restart and the notification of «the update could not be installed...» "is there still.

    I've seen this reported forever, it seems and many "bugs" is proposed, but none works. Anyone has an idea why this happens, or better yet, how to fix?

    Thanks for all the answers. I followed all, and was finally able to go get rid of 4500 duplicate bookmarks, more removed XMARKS, by process of elimination
    XMARKS causing Firefox to freeze
    4500 Favorites in doubles, causing all sorts of problems
    Removal of records and profiles corrected problems updates updates.
    All these problems hit me at once. Who would have thought?
    Thank you again...

  • I have version 3.6.23 on a desktip PC. When I "check for updates", I get a message that there are no updates available. What version should I do and how do I get it?

    I tried to use a tool of shmetsy.com for Etsy. I couldn't use it because of my version of Firefox - 3.6.23
    I went 'On Mozilla Firefox' to check the updates and got the message "there is no update available"

    I don't know what versions of Firefox work with Shmetsy. They have a page system requirements? It is not in the very short FAQ...

    You have later in the line of 3.6.

    If you want Firefox 7, go to http://www.mozilla.org/firefox to get the installation program.

    Normally, the major updates go without a hitch, but just in case, I recommend to backup your Firefox settings to cover you in the rare case that something is not going. See your backup information. (You can copy your profile folder Firefox together somewhere outside the Mozilla folder).

  • I am owner of a mini iPad (MD528LL/A, s/n F4LKQ4N7f193), that I use mainly for the practice of music (iRig); can I upgrade to 9.2.1 and use new apps music?... I read where there are a few problems with older devices!

    I mainly use for music practi

    There is nothing wrong with this update.

    This update is designed to fill a long-standing security hole that took forever to connect Apple.

    In addition, this update was tailored to address issues on older models of iDevice.

    My advice on the conduct of iOS upgrades/updates.

    Ideally, your iDevice should maintain a minimum amount of free storage for 4 to 6 GB or more on any iDevice (more free space, the better it is), plus, more 50%-60% state of the battery to ensure smooth operation, as well as, to ensure the possibility of an update/upgrade installation to update iOS successful.
    In addition, it is better to upgrade an iDevice connected to a computer running iTunes with you sync iDevice had and backed up by iTunes rather than OTA Over The Air () using a wireless WiFi connection, if possible.

    Doing a major or critical OS update/update may be risky to do in Wifi or cell due to the risk of interruption of data or forged data, causing problems with downloading the OS data and the subsequent installation of the unit.

    Also, it is best to do the update/update via iTunes you will get the update/upgrade entire and not only a smaller WiFi download version/serving based on your iDevice to model that can or can not download everything that your particular iDevice needs.

    If you have no other choice than to use the Wifi, then make sure that you have a solid and stable connection the will of the signal does not induce the possibility of dropout data.

    I prefer the iTunes method because there is minimal risk, and I've never had PROBLEMS with ANY operating system, updates using this method.

    Good luck!

  • VO gets 25 records, when there are 150 in the iterator.

    Hi all

    I use the objects in view in my form of AD. In the associatd with the form bean, in a fo my methods, I loop in the iterator associated with this VO.
    I noticed that only 25 records are read, even if the number of lines is much more than that. I finished usinga loop and print each record in the VO and it prints only 25.
    How can I fix this VO to get back all my files at the same time? It will always bring only back 25 at a time?

    JDev - 11g used.

    The code I use to bring the lines is:

    numRows int = vo.getRowCount ();

    System.out.println ("* number of the lines" + numRows); This returns 150
    for (int i = 0; i < numRows; i ++) {}
    System.out.println ("Role data" + roledata);
    I'm trying to print data for each line of the role: I have not noticed that 25 lines printed in the newspapers.
    a code
    }
    What I doing wrong here?


    Thank you
    Saida.

    Published by: 859810 on August 8, 2011 02:38

    Have the largest RangeSize or - 1 (that's all) of the iterator (Goto pagedef-> CategoryViewIteratory select-> RangeSize Set to largest or - 1)

  • I'm on the channel to update Firefox 9.0 beta. There are new offers published on several sites in firefox download 9 beta 4. But Mozilla itself offers beta 3. Why this discrepancy?

    I used the manual control for updates and no updates found.
    The poster version as 9.0.0.3535 Windows Explorer

    After using a beta of download sites 4, my version in windows Explorer displays as: 9.0.0.4351

    Can you please clarify.

    See http://www.mozilla.org/en-US/firefox/all-beta.html

    You can check what version you have if you open the topic: buildconfig page and click on the "built in" link.

  • Alert to be fired only for the first record, when there are duplicate entries

    Hello

    This is related to the fact of Oracle 10 g.
    I have a block record multi in which I entered and save some codes, something like below

    Code Description
    =====================
    AAAAAAAAAAAA ABCD
    BBBBBBBBBBBBB PQRS
    GENEVIEVE DAVIS
    ABCD DHGFKSDHKSHG
    PQRS DFJHHGS
    EEEE SDT85604ET
    =====================

    Now I need to post a warning/msg to go when-validate-the field Code. So now if I'm on the first record, the alert/msg will appear for code ABCD which is Ok. Now, on the next album, I get a different code PQRS as indicated above, the new alert appears which is Ok. If I enter a code that has been previously entered into the record block multi and alert/msg had been exposed to the only first alert/msg need is not displayed now know if I enter ABCD again the fourth record, the alert should not be displayed.
    Note that this must be done at the time of data entry itself. I guess that maybe it can be done by using groups Records / table plsql.

    Help with a way to solve this matter will be highly appreciated...

    Thank you and best regards...

    As you have already guessed, you must be able to keep track of how many times a value has been entered. If you know what all the possible values of 'CODE' at design time, you can create a counter for each value variable, but it would be a total pain. A better solution would be to permanently keep a total dynamics you can quickly check against. For this I recommend you use a group of registration of forms. Take a look at the demo of Forms - record group treatment (duplicate values check) I wrote. Using the packet of forms Rec_Group condition in this demo, you can easily change the process listed in the working document in your scenario. Follow all the steps in the demo. For your situation, you must change the when-validate-Item trigger so that instead of checking the dupicates and omitting the form if a duplicate is found, you check the number of entries to a value in the record group and display a message if the number is 0 or not to display a message if the number is greater than 0. Your modified WVI trigger might look like this:

    DECLARE
       ignore     NUMBER := 0;
       bignore   BOOLEAN := FALSE;
    BEGIN
       IF ( :YOUR_BLOCK.CODE IS NOT NULL ) THEN
          ignore := Rec_Group.Get_Number(Rec_Group.rg_name, :YOUR_BLOCK.CODE);
          IF ( ignore = 0 ) THEN
              -- Display your message
          ELSE
              -- Don't display any message
          END IF;
          /* add the code to the record group */
          bIgnore := Rec_Group.Add_Value(rec_group.rg_name, :YOUR_BLOCK.CODE, :system.trigger_record);
       END IF;
    END;
    

    Hope this helps,
    Craig B-)

    If someone useful or appropriate, please mark accordingly.

    Published by: Silvere March 30, 2011 15:07

  • How to use the conditions where there are more than two options

    I have a blade that collects information from the user and then makes decisions based on the values entered. On a slide I use the widget drop-down list and list of"basic", "Intermediate" and "Advanced". I hoped to do is use the Coditional Structure as follows:

    1. If the Basic was selected slide goto BasicQuickQuiz
    2. If the intermediary has been selected goto slide IntermediateQuickQuiz
    3. If Advanced was selected slide goto AdvancedQuick Quiz

    I can make this work for Basic or intermediate, but I don't see how (or even if) I have a multi level if statement.
    My work is about:
    1. a button added logic:
    So basic, then got otherwise BasicQuickQuiz goto IntermediateQuickQuiz

    2. on the Enter slide on IntermediateQuickQuiz event:
    If the intermediary, then keep, otherwise goto slide AdvancedQuick Quiz

    It works, but it seems awkward - y at - it another way that this goal could be achieved?

    Tim

    What I was hoping to see was the ability to create several Else If statements within the only condition. I've changed it now to add two conditional statements, one after the other, but still find this unscrupulous feature.
    I will record a feature request to add a Select Case block / Switch style fuction to this group.
    However, since it is new I can live with the workflow (for this version of Cp anyway!)

    Tim

  • (Exactly) how to move the data from drive C to D, E, f discs where there are a lot of space?

    C = 14.65 GB, 18.30 MB available

    D = 59.87 GB, 49.82 GB available.
    E = 37,34 GB, 36.40 GB available.

    Create a folder in my music, photos, etc., move all the files in each of

    the new folder, once completed, switch to the other disk. As far what will other data, like

    3rd party software that is not part of the operating system, you must install it to another

    drive, uninstall, reinstall after pc reboot...

    If drive D: E: F: & is actuall hard disks, not partitions, install data &

    software for them is a good performance upgrade, otherwise, its purpose is

    marginal... For more information, try this link.

    http://www.Microsoft.com/mspress/books/sampchap/6559.aspx#106

    Or this link.

    http://TechNet.Microsoft.com/en-us/library/cc750856.aspx

  • Add several legends where there are legends (all different)

    I subtitle my photos football with each player two-digit shirt number, IE. 01-99 I can upload to SmugMug with the intention to allow viewers to use the "Search" function to display pictures of their player only. Unfortunately, the SmugMug search engine ignores a legend who has the 2 characters or less.  I would like to add all my legends of football in Lightroom 3 with an additional identifier to lengthen the legend so it will become can be consulted, for example add "01" to "Titans01".  I don't care if the identifier is at the beginning or at the end.  I just want to be able to add a whole album at the same time, rather than one at a time.

    IIRC, John Beardsworth has a nice plugin that adds a text string to existing legends. You can download & test, then buy if it will work for you.

    http://photographers-Toolbox.com/products/jbeardsworth/FindReplace/

  • How do to automatically reduce music when there are voices in first adobe?

    Hello

    I don't want to create a few audio keys at every moment in my video where there are voices.

    is it possible to do it automatically?

    I googled and Google but have not found!

    Thank you very much!

    I do sidechain ducking in hearing, using dynamic link between Pr and the AU. I don't think that the latest version of Pr has the feature, but there was, maybe still are, addons and third to do it entirely in PR.  I've never used them. Here is an old link that might give you some ideas if you want to go this way CreativeCOW

    I think that the road to the AU is much easier if you have this software.

  • Why there are graphics and Movie Clip in Flash?

    Where there are graphics and Movie Clip in Flash?

    What is the deference?
    When to choose one of the other?
    It would be simpler if Flash does that Movie Clip (so people are not confusing choose)?

    Thank you!

    Main differences are:

    MovieClip symbols contain their own calendars. That's why they can run animations inside of them that are independent of the main timeline. They are also targeted by actionscript to run the script-driven events, animations, changes, etc.

    Graphic symbols are better used to hold static images images, text or what you create with the drawing tools. Although you can run an animation in them, it should the main timeline to be of the same length to see the full animation. Graphic symbols cannot be targeted by actionscript.

  • Change DUP_VAL_INDEX "Insert where there is no other record update"

    In an environment of retail, where transactions are posted in a header, and a table of the line, the code below inserts data into the table tran_head based on the values obtained from a cursor. Updates in a transaction especially produce about 1%, and the existing code uses a DUP_VAL_INDEX system exception to publish updates to a transaction.

    How to change the process of "If the folder exists and then insert another update? Since updates happen only from 1% of the time, the INSERT statement may have to be placed at the beginning.

    I tried IF EXISTS before the INSERT statement, but it does not work in PL/SQL.

    I am using Oracle 11g, Oracle 11.2.0.2 version
            
           CURSOR C1 (v_begin_date DATE,
                                v_end_date DATE) IS
            SELECT *
            FROM   rex_head_extract 
            WHERE  TRUNC(create_date) BETWEEN v_begin_date AND v_end_date;
            
                 
       BEGIN
                FOR I IN C1 (v_begin_date, v_end_date)
               LOOP
                  v_record_count := v_record_count + 1;
                  
                  SELECT kcpos_tran_seq.nextval
                  INTO   l_tran_seq_nbr
                  FROM   dual;
                              
                    BEGIN                 
                         INSERT INTO tran_header_base
                          (TRAN_SEQ_NBR,
                           ORG_NUMBER,
                           STORE_NUMBER,
                           TRAN_DATE,
                           TERMINAL_NUMBER,
                           TRAN_NUMBER,
                           TRAN_TIME,
                           BATCH_NUMBER,
                           BATCH_TYPE,
                           TRAN_TYPE,
                           SUB_TRAN_TYPE,
                           CLERK_CODE)
                           VALUES (l_tran_seq_nbr,
                           1,
                           I.store_number,
                           I.tran_date,
                           I.terminal_number,
                           I.tran_number,
                           I.tran_time,
                           I.batch_number,
                           I.batch_type,
                           I.tran_type,
                           I.sub_tran_type,
                           I.clerk_code)
                            EXCEPTION
                              WHEN DUP_VAL_ON_INDEX THEN
                                  UPDATE tran_header_base
                                   SET (BATCH_NUMBER,TRAN_TIME, BATCH_TYPE, TRAN_TYPE,SUB_TRAN_TYPE, CLERK_CODE)=
                             (SELECT BATCH_NUMBER, TRAN_TIME, BATCH_TYPE, TRAN_TYPE,SUB_TRAN_TYPE, CLERK_CODE
                                  FROM  rex_head_extract
                                             WHERE  rex_seq_nbr = I.rex_seq_nbr
                                            AND  revision_number = I.revision_number
                                            AND  store_number    = I.store_number
                                            AND  tran_date       = I.tran_date
                                            AND  terminal_number = I.terminal_number
                                            AND  tran_number     = I.tran_number
                                            AND  trunc(create_date) BETWEEN v_begin_date AND v_end_date)
                                  WHERE EXISTS ( SELECT * FROM rex_head_extract
                                                        WHERE rex_seq_nbr = I.rex_seq_nbr
                                                        AND  revision_number = I.revision_number 
                                                        AND store_number = I.store_number
                                                        AND  tran_date  = I.tran_date
                                                        AND  terminal_number = I.terminal_number
                                                        AND  tran_number     = I.tran_number);
                     END;
                  END LOOP; 
       EXCEPTION  -- MAIN
          ....
          .....
          .....
       END;
    DDL statement for cursor table
    CREATE TABLE REX_HEAD_EXTRACT
    (
      REX_SEQ_NBR         NUMBER(20)            NOT NULL,
      LOAD_ID             NUMBER(10)            NOT NULL,
      REVISION_NUMBER         NUMBER(3)             NOT NULL,
      DAY                     NUMBER(3)             NOT NULL,
      RESA_TRAN_SEQ_NO        NUMBER(20)            NOT NULL,
      BUSINESS_DATE           DATE                  NOT NULL,
      TRAN_SEQ_NBR            NUMBER(12),
      ORG_NUMBER              NUMBER,
      STORE_NUMBER            NUMBER,
      TRAN_DATE               DATE,
      TERMINAL_NUMBER         NUMBER,
      TRAN_NUMBER             NUMBER,
      TRAN_TIME               DATE,
      BATCH_NUMBER            VARCHAR2(8 BYTE),
      BATCH_TYPE              VARCHAR2(4 BYTE),
      TRAN_TYPE               VARCHAR2(4 BYTE),
      SUB_TRAN_TYPE           VARCHAR2(4 BYTE),
      CLERK_CODE              VARCHAR2(15 BYTE)     NOT NULL);
    
    ALTER TABLE REX_HEAD_EXTRACT ADD (
      CONSTRAINT XPK_REX_HEAD_EXTRACT_1
      PRIMARY KEY
      (BCF_REX_SEQ_NBR, TRAN_DATE)
      USING INDEX XPK_REX_HEAD_EXTRACT_1);
    DDL statement for the target TRAN_HEAD_BASE table
    CREATE TABLE TRAN_HEADER_BASE
    (
      TRAN_SEQ_NBR            NUMBER(12),
      ORG_NUMBER              NUMBER,
      STORE_NUMBER            NUMBER,
      TRAN_DATE               DATE,
      TERMINAL_NUMBER         NUMBER,
      TRAN_NUMBER             NUMBER,
      TRAN_TIME               DATE,
      BATCH_NUMBER            VARCHAR2(8 BYTE),
      BATCH_TYPE              VARCHAR2(4 BYTE),
      TRAN_TYPE               VARCHAR2(4 BYTE),
      SUB_TRAN_TYPE           VARCHAR2(4 BYTE),
      CLERK_CODE              VARCHAR2(15 BYTE)     NOT NULL);
    
    ALTER TABLE TRAN_HEADER_BASE ADD (
      CONSTRAINT XPKKCPOS_TRAN_HEADER_1
      PRIMARY KEY
      (TRAN_SEQ_NBR, TRAN_DATE)
      USING INDEX LOCAL);
    Published by: 934858 on August 9, 2012 07:17

    934858 wrote:
    A merger (or even insertion/update) would be desirable for a volume of 1 M lines?

    Well a unique fusion would be probably more faster then 1 million insert tent and 1000 updates. The main problem in your code are many pl/sql - SQL context switches. For each, you will get at least 4 context switches (fetch = sql, pl/sql = loop, insert is sql,...). They slow down this operation. In BULK FETCH (with LIMIT) and FORALL could help. But it takes a bit of programming and the understanding of this concept.

    But you can also write a single insert and a single update that does all the work. This should be comparable fast.

    There should be two ways.
    (a) using the clause LOG_ERRORS, for all lines that are not allowed (due to the UK) in a separate table of error. Then, run a single update, using this result records in the error table.
    (b) write the Insert... Select so that duplicate records are not inserted. Then write an update that only duplicates are updated. This mimicks the merge, but you may have a little more control over the statements.

    Such a single insert command should resemble the following:
    not tested

    INSERT INTO tran_header_base b
                          (TRAN_SEQ_NBR,
                           ORG_NUMBER,
                           STORE_NUMBER,
                           TRAN_DATE,
                           TERMINAL_NUMBER,
                           TRAN_NUMBER,
                           TRAN_TIME,
                           BATCH_NUMBER,
                           BATCH_TYPE,
                           TRAN_TYPE,
                           SUB_TRAN_TYPE,
                           CLERK_CODE)
     select KCPOS_TRAN_SEQ.nextval,
                           1,
                           I.store_number,
                           I.tran_date,
                           I.terminal_number,
                           I.tran_number,
                           I.tran_time,
                           I.batch_number,
                           I.batch_type,
                           I.tran_type,
                           I.sub_tran_type,
                           I.clerk_code
    FROM   rex_head_extract i
    WHERE  i.create_date >= v_begin_date
    and i.create_date < trunc(v_end_date)+1
    and not exists (select null
                         from tran_header_base b2
                         where b2.I.store_number = I.store_number
                         and b2.TRAN_NUMBER = I.TRAN_NUMBER    -- here you need the full uniquness check
                          )
    ;
    

    An expression "not in" could be faster, depends on many factors.

    Published by: Sven w. on August 10, 2012 15:36

    Published by: Sven w. on August 10, 2012 15:40

  • I have an iMac (2015).  When I open Garageband, there are only two buttons on the control bar, play and stop.  No record button, rewind or ff.  Where are they and how can I make it appear?

    I have an iMac (2015). When I open Garageband, there are only two buttons on the control bar, play and stop. No record button, rewind or ff. Where are they and how can I make it appear?

    Try to enlarge the GarageBand window by dragging the corners of resizing.

    If she looks like this, your window is small:

    You can also try to click the double arrow at the end of the toolbar to reveal more options.

  • There is NO selection update software on my phone! How are Iphone 3 # IOS updated? It may not be this difficult OR the answer is "It cannot be upgraded" - which is?

    There is NO selection update software on my phone! How are Iphone 3 # IOS updated?

    It may not be this difficult OR the answer is "It cannot be upgraded" - which is?

    The model number you have listed is an iPhone 4, which can be upgraded to iOS 7.1.2. To have the option to update software on the phone, you need at least iOS 5, otherwise you will need to use iTunes on your computer sync to perform the upgrade.

Maybe you are looking for

  • Windows Live Mail will not accept the password

    I was happily using Windows Live Mail to get my emails to icloud. However, all of a sudden he repeat the authentication has failed. I've tried everything. Change the password, delete the account and he seized again.alw Nothing works. It will be not a

  • This AE work?

    An excerpt from a Subvi, which I use for a task of acquiring meter is attached. He acquires a RPM, but occasionally gets one reading error, either by noise or other (blips above 16 000 rpm when the value is less than 8 800). I rewrote the Subvi to be

  • 10 Windows dose exist

    10 Windows dose exist?

  • How can I activate my computer accept third party cookies__

    I trrying to make a payment to bagster and it won't accept it because it says that my computer will not allow third-party cookies

  • System event notification services error

    A couple of weeks, I started getting a message at startup in VISTA. The message appears in the lower right. It is said:Unable to connect to a windows service. Windows could not connect to the System Event Notification Services service. This problem p