Update statement Select MAX

Hello guys, small head scratcher here (probably just my mind head)

Summary of the issue: Updated between two tables, try to use the rank, will not work.

I took a few of the fields of interest here: -.
CREATE TABLE spell_tags (
      Spell_ID             varchar2(50) ,
      service_line_spell     varchar2(25) );
CREATE TABLE ranked_spells(
     spell_ID varchar2(10) ,
     dominant_SSNDS varchar2(25) ,
     service_line varchar2(25) ,
     Rank varchar2(3) NOT NULL ) ;
Samples: -.
INSERT INTO RANKED_SPELLS ("SPELL_ID" ,"DOMINANT_SSNDS" ,"SERVICE_LINE" ,"RANK" ) VALUES ('100002' ,'08' ,'SD08o' ,'213' );
INSERT INTO RANKED_SPELLS ("SPELL_ID" ,"DOMINANT_SSNDS" ,"SERVICE_LINE" ,"RANK" ) VALUES ('100002' ,'08' ,'SD08s' ,'210' );
INSERT INTO RANKED_SPELLS ("SPELL_ID" ,"DOMINANT_SSNDS" ,"SERVICE_LINE" ,"RANK" ) VALUES ('100003' ,'08' ,'SD22m' ,'416' );
INSERT INTO RANKED_SPELLS ("SPELL_ID" ,"DOMINANT_SSNDS" ,"SERVICE_LINE" ,"RANK" ) VALUES ('100003' ,'08' ,'SD23x' ,'207' );
INSERT INTO SPELL_TAGS ("SPELL_ID" , "SERVICE_LINE_SPELL"  ) VALUES ('100002' ,'' );
INSERT INTO SPELL_TAGS ("SPELL_ID" , "SERVICE_LINE_SPELL"  ) VALUES ('100003' ,'' );
Data looks like this: -.
 Select * from spell_tags;

SPELL_ID                                           SERVICE_LINE_SPELL
-------------------------------------------------- -------------------------
100002
100003

2 rows selected.


 Select * from ranked_spells;


SPELL_ID   DOMINANT_SSNDS            SERVICE_LINE              RANK
---------- ------------------------- ------------------------- ---
100002     08                        SD08o                     213
100002     08                        SD08s                     210
100003     08                        SD22m                     416
100003     08                        SD23x                     207

4 rows selected.
Basically, I need to run and update the declaration (not plsql) to update the Spell_tags table service_line_spell field with the service_line of the ranked_spells table (lowest rank)

Here are a few failed attempts, do not laugh ;)
update spell_tags
set service_line_spell = (select max(service_line) from ranked_spells
where spell_tags.spell_id = ranked_spells.spell_ID
group by service_line, rank
having rank = min(rank))
where spell_ID in (select distinct spell_ID from ranked_spells);

ERROR at line 2:
ORA-01427: single-row subquery returns more than one row


update speccom.spell_tags
set service_line_spell = (select b.service_line from ranked_spell b
where spell_tags.spell_id = ranked_spells.spell_ID
and ranked_spells.rank = min(ranked_spells.rank) group by service_line, rank)
where exists
(select spell_ID from ranked_spells
where spell_ID in (select distinct spell_ID from ranked_spells);

ERROR at line 4:
ORA-00934: group function is not allowed here
This is the result, I need: -.
 Select * from spell_tags;

SPELL_ID                                           SERVICE_LINE_SPELL
-------------------------------------------------- -------------------------
100002                                             SD08s
100003                                               SD23x
Any ideas guys?

Something like that?

update spell_tags
set service_line_spell = (select max(service_line) keep (dense_rank last order by rank desc)
                          from ranked_spells
                          where spell_tags.spell_id = ranked_spells.spell_ID
                          )
where spell_ID in (select distinct spell_ID from ranked_spells);

Published by: UW (Germany) on 16.08.2012 16:48 (changed min at the maximum, but it makes only a difference when there is same ranking values)

Tags: Database

Similar Questions

  • How to optimize the update statement so that the query is reading the same table?

    Hi all

    I have a process with the following UPDATE statement:

    Sales_val update

    SET ship_date =)
    Select max (hist.ship_date)

    FROM sales_hist hist

    WHERE hist. X_ID = A.X_ID

    AND hist. X_VAL = A.X_VAL)

    ) WHERE EXISTS (select * from sales_hist hist where )

    WHERE hist. X_ID = A.X_ID

    AND hist. X_VAL = A.X_VAL

    )

    sales_val - 50 lines mln (unique index)

    sales_hist - 20 mln ranks (unique index)

    I met many problems with waits and locks - how to optimize to avoid locks using the parameters of tables or changes of the declaration? or maybe is there another way to do optimization ?

    Kind regards

    Bolo

    Thank you for that. Collect in bulk Unfortunatelly + FORALL does not work with the types in 10g - solution is to use the FOR loop and is not as effective as FORALL in many cases. I do still some tests to solve this problem - I'll put you once it's done.

    EDIT: hash partitioning + fusion - 3-5 minutes (time), so for now it's the solution to the problem. Thank you all for the great discussion!

  • Solution probably really Simple (where in the Update statement)

    Right,

    I have a table. In this table, there are 5 fields for the sake of arguments:

    COLUMN_ONE COLUMN_THREE COLUMN_FOUR COLUMN_FIVE COLUMN_TWO

    On this table there will be duplicate records, but only the column 1, column 2 and 3 on these "duplicate" files will be the same, column 4 will be different (column 4 is not a unique identifier, but if there are duplicate records, it will be different at least 2 records). Column 5 is not yet filled, all null.

    I need a way to update column 5 of these duplicate records. However, let me update on one of the folders and the criteria for this will be where column_4 = "Hello".

    So far I came with an update statement similar to the following, but I don't know where with her:

    UPDATE DANS_TABLE
    SET COLUMN_five = "DUPLICATE".
    WHERE EXISTS (SELECT column_one | column_two | column_three, COUNT (*))
    OF DANS_TABLE
    GROUP BY column_one | column_two | column_three
    SEEN (COUNT (*) > 1)) and column_four = 'Hello ';

    For any help, thank you very much! Much appreciated,

    Dan

    This is the query that updates that one line duplicated to column_five. I hope this helps...

    UPDATE DANS_TABLE x 1
    SET COLUMN_five = "DUPLICATE".
    WHERE THERE ARE
    (
    Select r_id of
    (select max (rowid) r_id, column_one | column_two | column_three)
    of DANS_TABLE t1 where exists
    (
    Select str of
    (
    SELECT column_one | column_two | column_three str, COUNT (*)
    OF DANS_TABLE
    GROUP BY column_one | column_two | column_three
    SEEN (COUNT (*) > 1)
    ) t2 where t2.str = t1.column_one | T1.column_two | T1.column_three
    ) column_one group | column_two | column_three
    ) x 2 where x 1 .rowid = 2 .r_id x
    ) and column_four = 'Hello ';

  • How can I use multiple row subqueries in update statement

    Hai All

    I'm using the Group feature in my update statement... and I need to update several lines so I need to use several rows

    subquery pls tell me how to use multiple row subqueries in update statement


    For example

    while I use it like this I got an error

    Update dail_att set outtime to (select max (r2.ptime) in the temp_att where empcode = r2.enpno and)

    bar code = r2.cardn and group attend_date = r2.pdate by enpno, update, cardn);


    Pls tell me how to use for example


    Thanks and greetings

    Srikkanth.M

    Hello

    for r2 loop p1

    R2 is a line of the cursor,

    Max (R2. PtIMe)? It is always equal to r2.ptime if the select statement returns rows.

  • Performance issue with the Update statement

    Oracle 10204

    I have a problem related to updaing one performance table.
    only 5000 lines should be updated.
    Hir are some details on the tables/M.V concerned:
    TABLE_NAME     LAST_ANALYZED          NUM_ROWS     SAMPLE_SIZE
    PS_RF_INST_PROD     1/20/2010 1:14:22 AM     7194402          7194402
    BL_TMP_INTRNT     1/27/2010 9:08:54 AM     885445          885445
    NAP_INTERNET     1/25/2010 11:47:02 AM     7053990          560777
    I tried to run the update with two options:
    1. with the plan than oracle choose.
    2. with notes I added.
    In both cases I he collapsed after more than an hour.

    Can any one suggest how to speed it up?

    Below are for the two option tkprof.
    Please note that beside the defualt statistics on those tables i also gathered statistics on two column level as followed:
    BEGIN
      SYS.DBMS_STATS.GATHER_TABLE_STATS (
          OwnName        => 'B'
         ,TabName        => 'BL_TMP_INTRNT'
        ,Estimate_Percent  => 100
        ,Degree            => 8
        ,Cascade           => TRUE
        ,No_Invalidate     => FALSE);
    END;
    /
    
    exec dbms_stats.gather_table_stats('B' , 'BL_TMP_INTRNT', cascade=>TRUE, method_opt=>'for columns SERVICE_UID size 254');
    exec dbms_stats.gather_table_stats('B' , 'BL_TMP_INTRNT', cascade=>TRUE, method_opt=>'for columns FIX_IP_USER size 254');
    Plan 1
    UPDATE BL_TMP_INTRNT A
       SET A.FIX_IP_USER =
              (SELECT C.PRODUCT_ID
                 FROM NAP_INTERNET B, PS_RF_INST_PROD C
                WHERE B.INST_PROD_ID = A.SERVICE_UID
                  AND B.SETID = 'SHARE'
                  AND C.INST_PROD_ID = B.NAP_SURF_UID)
     WHERE A.TERM_DESC LIKE '%ip%'
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.03       0.02          0          0          0           0
    Execute      1   1166.64    4803.78   17989002   18792167        117           0
    Fetch        0      0.00       0.00          0          0          0           0
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        2   1166.67    4803.81   17989002   18792167        117           0
    
    Misses in library cache during parse: 1
    Optimizer mode: FIRST_ROWS
    Parsing user id: 13
    
    Rows     Row Source Operation
    -------  ---------------------------------------------------
          0  UPDATE  BL_TMP_INTRNT (cr=0 pr=0 pw=0 time=2 us)
         46   TABLE ACCESS FULL BL_TMP_INTRNT (cr=586400 pr=22228 pw=0 time=15333652 us)
         15   HASH JOIN  (cr=18170453 pr=17931639 pw=0 time=3991064192 us)
         46    MAT_VIEW ACCESS FULL NAP_INTERNET (cr=5659886 pr=5655436 pw=0 time=988162557 us)
    329499624    MAT_VIEW ACCESS FULL PS_RF_INST_PROD (cr=12545734 pr=12311281 pw=0 time=2636471644 us)
    plan 2
    UPDATE BL_TMP_INTRNT A
       SET A.FIX_IP_USER =
              (SELECT /*+ index(b NAP_INTERNET_PK) index(c PS_RF_INST_PROD_PK)*/ C.PRODUCT_ID
                 FROM NAP_INTERNET B, PS_RF_INST_PROD C
                WHERE B.INST_PROD_ID = A.SERVICE_UID
                  AND B.SETID = 'SHARE'
                  AND C.INST_PROD_ID = B.NAP_SURF_UID)
     WHERE A.TERM_DESC LIKE '%ip%'
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.02       0.02          0          0          0           0
    Execute      1   4645.25    4613.70      95783   39798095        735           0
    Fetch        0      0.00       0.00          0          0          0           0
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        2   4645.27    4613.73      95783   39798095        735           0
    
    Misses in library cache during parse: 1
    Optimizer mode: FIRST_ROWS
    Parsing user id: 13
    
    Rows     Row Source Operation
    -------  ---------------------------------------------------
          0  UPDATE  BL_TMP_INTRNT (cr=0 pr=0 pw=0 time=1 us)
        473   TABLE ACCESS FULL BL_TMP_INTRNT (cr=10461 pr=10399 pw=0 time=4629385 us)
        408   MAT_VIEW ACCESS BY INDEX ROWID PS_RF_INST_PROD (cr=39776109 pr=85381 pw=0 time=4605125045 us)
       1350    NESTED LOOPS  (cr=39784584 pr=84974 pw=0 time=4601874262 us)
        470     MAT_VIEW ACCESS BY INDEX ROWID NAP_INTERNET (cr=23569112 pr=50472 pw=0 time=2544364336 us)
        470      INDEX FULL SCAN NAP_INTERNET_PK (cr=23568642 pr=50005 pw=0 time=2540300981 us)(object id 11027362)
        408     INDEX FULL SCAN PS_RF_INST_PROD_PK (cr=16215472 pr=34502 pw=0 time=2057500175 us)(object id 10980137)
    
    
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file scattered read                       1300        0.50          4.27
      db file sequential read                     85707        0.51         29.88
      latch: cache buffers chains                     1        0.00          0.00
      log file sync                                   1        0.00          0.00
      SQL*Net break/reset to client                   1        0.00          0.00
      SQL*Net message to client                       1        0.00          0.00
      SQL*Net message from client                     1       14.73         14.73
    ********************************************************************************

    The problem in your update statement that is the query in your set clause is executed many times that there are lines in BL_TMP_INTRNT of 'intellectual property' in their column of term_desc. You mentioned there are about 5000, then the query joining NAP_INTERNET with PS_RF_ISNT_PROD is begun 5000 times.
    The trick is to join only once, be updated using join views - provided that it is preserved - key or by using the merge statement.

    Here is an example:

    SQL> create table bl_tmp_intrnt (fix_ip_user,service_uid,term_desc)
      2  as
      3   select level
      4        , level
      5        , 'aipa'
      6     from dual
      7  connect by level <= 5000
      8  /
    
    Tabel is aangemaakt.
    
    SQL> create table nap_internet (inst_prod_id,setid,nap_surf_uid)
      2  as
      3   select level
      4        , 'SHARE'
      5        , level
      6     from dual
      7  connect by level <= 10
      8  /
    
    Tabel is aangemaakt.
    
    SQL> create table ps_rf_inst_prod (product_id,inst_prod_id)
      2  as
      3   select level
      4        , level
      5     from dual
      6  connect by level <= 10
      7  /
    
    Tabel is aangemaakt.
    
    SQL> exec dbms_stats.gather_table_stats(user,'bl_tmp_intrnt')
    
    PL/SQL-procedure is geslaagd.
    
    SQL> exec dbms_stats.gather_table_stats(user,'nap_internet')
    
    PL/SQL-procedure is geslaagd.
    
    SQL> exec dbms_stats.gather_table_stats(user,'ps_rf_inst_prod')
    
    PL/SQL-procedure is geslaagd.
    
    SQL> set serveroutput off
    SQL> update ( select a.fix_ip_user
      2                , c.product_id
      3             from bl_tmp_intrnt a
      4                , nap_internet b
      5                , ps_rf_inst_prod c
      6            where a.term_desc like '%ip%'
      7              and a.service_uid = b.inst_prod_id
      8              and b.setid = 'SHARE'
      9              and b.nap_surf_uid = c.inst_prod_id
     10         )
     11     set fix_ip_user = product_id
     12  /
       set fix_ip_user = product_id
           *
    FOUT in regel 11:
    .ORA-01779: cannot modify a column which maps to a non key-preserved table
    

    Join is one key kept in the case of b.inst_prod_id and c.inst_prod_id are unique. Please refer to the documentation for more information here: http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/views.htm#sthref3055

    SQL> alter table nap_internet add primary key (inst_prod_id)
      2  /
    
    Tabel is gewijzigd.
    
    SQL> alter table ps_rf_inst_prod add primary key (inst_prod_id)
      2  /
    
    Tabel is gewijzigd.
    
    SQL> update /*+ gather_plan_statistics */
      2         ( select a.fix_ip_user
      3                , c.product_id
      4             from bl_tmp_intrnt a
      5                , nap_internet b
      6                , ps_rf_inst_prod c
      7            where a.term_desc like '%ip%'
      8              and a.service_uid = b.inst_prod_id
      9              and b.setid = 'SHARE'
     10              and b.nap_surf_uid = c.inst_prod_id
     11         )
     12     set fix_ip_user = product_id
     13  /
    
    10 rijen zijn bijgewerkt.
    
    SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'))
      2  /
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------
    SQL_ID  c7nqbxwzpyq5p, child number 0
    -------------------------------------
    update /*+ gather_plan_statistics */        ( select a.fix_ip_user               , c.product_id            from bl_tmp_intrnt
    a               , nap_internet b               , ps_rf_inst_prod c           where a.term_desc like '%ip%'             and
    a.service_uid = b.inst_prod_id             and b.setid = 'SHARE'             and b.nap_surf_uid = c.inst_prod_id        )
    set fix_ip_user = product_id
    
    Plan hash value: 1745632149
    
    ---------------------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                      | Name            | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
    ---------------------------------------------------------------------------------------------------------------------------------------
    |   1 |  UPDATE                        | BL_TMP_INTRNT   |      1 |        |      0 |00:00:00.01 |      32 |       |       |          |
    |   2 |   NESTED LOOPS                 |                 |      1 |     10 |     10 |00:00:00.01 |      21 |       |       |          |
    |   3 |    MERGE JOIN                  |                 |      1 |     10 |     10 |00:00:00.01 |       9 |       |       |          |
    |*  4 |     TABLE ACCESS BY INDEX ROWID| NAP_INTERNET    |      1 |     10 |     10 |00:00:00.01 |       2 |       |       |          |
    |   5 |      INDEX FULL SCAN           | SYS_C00132995   |      1 |     10 |     10 |00:00:00.01 |       1 |       |       |          |
    |*  6 |     SORT JOIN                  |                 |     10 |    250 |     10 |00:00:00.01 |       7 |   267K|   256K|  237K (0)|
    |*  7 |      TABLE ACCESS FULL         | BL_TMP_INTRNT   |      1 |    250 |   5000 |00:00:00.01 |       7 |       |       |          |
    |   8 |    TABLE ACCESS BY INDEX ROWID | PS_RF_INST_PROD |     10 |      1 |     10 |00:00:00.01 |      12 |       |       |          |
    |*  9 |     INDEX UNIQUE SCAN          | SYS_C00132996   |     10 |      1 |     10 |00:00:00.01 |       2 |       |       |          |
    ---------------------------------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - filter("B"."SETID"='SHARE')
       6 - access("A"."SERVICE_UID"="B"."INST_PROD_ID")
           filter("A"."SERVICE_UID"="B"."INST_PROD_ID")
       7 - filter("A"."TERM_DESC" LIKE '%ip%')
       9 - access("B"."NAP_SURF_UID"="C"."INST_PROD_ID")
    
    32 rijen zijn geselecteerd.
    
    SQL> rollback
      2  /
    
    Rollback is voltooid.
    

    And it's your current statement. Please note the number of 5000 in the column begins:

    SQL> UPDATE /*+ gather_plan_statistics */ BL_TMP_INTRNT A
      2     SET A.FIX_IP_USER =
      3            (SELECT C.PRODUCT_ID
      4               FROM NAP_INTERNET B, PS_RF_INST_PROD C
      5              WHERE B.INST_PROD_ID = A.SERVICE_UID
      6                AND B.SETID = 'SHARE'
      7                AND C.INST_PROD_ID = B.NAP_SURF_UID)
      8   WHERE A.TERM_DESC LIKE '%ip%'
      9  /
    
    5000 rijen zijn bijgewerkt.
    
    SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'))
      2  /
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------------------------------------------
    SQL_ID  f1qtnpa0nmbh8, child number 0
    -------------------------------------
    UPDATE /*+ gather_plan_statistics */ BL_TMP_INTRNT A    SET A.FIX_IP_USER =           (SELECT
    C.PRODUCT_ID              FROM NAP_INTERNET B, PS_RF_INST_PROD C             WHERE B.INST_PROD_ID
    = A.SERVICE_UID               AND B.SETID = 'SHARE'               AND C.INST_PROD_ID =
    B.NAP_SURF_UID)  WHERE A.TERM_DESC LIKE '%ip%'
    
    Plan hash value: 3190675455
    
    -----------------------------------------------------------------------------------------------------------
    | Id  | Operation                     | Name            | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    -----------------------------------------------------------------------------------------------------------
    |   1 |  UPDATE                       | BL_TMP_INTRNT   |      1 |        |      0 |00:00:00.10 |    5076 |
    |*  2 |   TABLE ACCESS FULL           | BL_TMP_INTRNT   |      1 |    250 |   5000 |00:00:00.01 |       7 |
    |   3 |   NESTED LOOPS                |                 |   5000 |      1 |     10 |00:00:00.02 |      24 |
    |*  4 |    TABLE ACCESS BY INDEX ROWID| NAP_INTERNET    |   5000 |      1 |     10 |00:00:00.01 |      12 |
    |*  5 |     INDEX UNIQUE SCAN         | SYS_C00132995   |   5000 |      1 |     10 |00:00:00.01 |       2 |
    |   6 |    TABLE ACCESS BY INDEX ROWID| PS_RF_INST_PROD |     10 |     10 |     10 |00:00:00.01 |      12 |
    |*  7 |     INDEX UNIQUE SCAN         | SYS_C00132996   |     10 |      1 |     10 |00:00:00.01 |       2 |
    -----------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - filter("A"."TERM_DESC" LIKE '%ip%')
       4 - filter("B"."SETID"='SHARE')
       5 - access("B"."INST_PROD_ID"=:B1)
       7 - access("C"."INST_PROD_ID"="B"."NAP_SURF_UID")
    
    29 rijen zijn geselecteerd.
    

    Kind regards
    Rob.

  • Unfortunately, important updates and selection of optional to install updates gives no information.

    Windows Update, you can click on the links "# important updates are available" and "optional updates # are available.
    But since I had a few problems with an update some time ago a got help from MS to sort I don't get no information on updates by following these links and the design of the window is not the same as it used to be.

    Usually there will be a list updates available with code update as "(K477415)" or similar.  Now, however, all I see is an empty box with 2 tabs to the left saying Important and optional. The two tabs are clickable, but nothing happens... no list of the updates available on one of them even if he states clearly he doesn't are updates available in both categories.

    The only thing I can do is have the update then browse the updates, they are in the section of installed updates and selected those to uninstall.  Or simply not install one of them. I can't select or deselect updated as to control those to install because they are not included.

    It seems that windows updates is screwed

    Try these:

    http://support.Microsoft.com/default.aspx/KB/971058

    http://support.Microsoft.com/kb/310747 (should work for vista and 7)

  • SQLite Update statement

    I have a database in my application, and part of it (obviously) will require the user to update the database with the current information.

    There are 24 columns of the table, and I have my update function works almost 100%, except that there are two drop downs, and when the user updates the record individual everything that is selected in the fall of two downs, is applied to all records.

    My update statement is like this:

    var statement:SQLStatement = new SQLStatement();statement.sqlConnection = connection;statement.text = "UPDATE TABLE SET " +      "OneFish=?, " +       "TwoFish=?, " +       "RedFish=?, " +       "BlueFish=?, " +          // CONTINUES AS TEXT INPUTS DOWN TO       "DropDown1=?, " +     "DropDown2=?, " +          // FEW MORE TEXT INPUTS THEN                "WHERE RECORD_ID=?";       statement.parameters[0] = OneFish.text;       statement.parameters[1] = TwoFish.text;       statement.parameters[2] = RedFish.text;       statement.parameters[3] = BlueFish.text;          // CONTINUES AS TEXT INPUTS DOWN TO       statement.parameters[17] = DropDown1.selectedItem;        statement.parameters[18] = DropDown2.selectedItem;          // FEW MORE TEXT INPUTS THEN        statement.parameters[23] =                FishOption.selectedItem.RECORD_ID;                statement.addEventListener(SQLEvent.RESULT, updateWorked);                statement.addEventListener(SQLErrorEvent.ERROR, updateFailed);                statement.execute();
    

    ALL updates day very well and shown to the a specific RECORD_ID. However, the decline in the bottom change overall.

    This does not happen on my service of "addFish". Someone out there have any ideas why this is?

    Update: It isn't my SQL. If I close the application and then go back, the changes show correctly. The drop down menus are simply not refreshing properly after the update of the database.

    J.Rab!

    I literally JUST thought out and sat next to the woman to rejoice with the laptop on my lap! Then the BlackBerry made his small notification and I said out loud, "oh look, it's probably somebody tell me what I did wrong before that I could update!

    Had dinner and a record label with a look at it to understand.

    To display the resulting data & update fields, I was setting the command prompt from the drop down menus! I went my output and changed function use the selectedItem and success!

    I also forgot to include a refreshTheDatabase(); at the end of my updateFunction() function call;

    I hit a brick wall with this for several hours this afternoon and I can't believe it was that simple! I should have got up and walked away earlier!

  • Update statement

    Hi friends,

    Need your help with an update statement.

    Update t set t.icode int_tab =.

    (select ac.icode in the ac_tab ac, ed edition

    where ac.current_code = ed.unit)

    where ed.process_no = t.action_no);

    where ed.process_no = t.action_no

    *

    ERROR on line 4:

    ORA-00904: "ED". "" PROCESS_NO ": invalid identifier

    Basically, we need to update int_tab.icode with ac_tab.icode where ac_tab.current_code = edition.unit

    Thank you very much

    I suggest you MERGE. Inside () I call "source" can be controlled carefully. And then you can easily do the UPDATE

    No funny Executive plans and if he SELECT jobs, UPDATE works as well.

    MERGE into the target int_tab

    USING (SELECT t.rowid, rid, ac.icode,

    Of ac_tab ac

    Join IN-HOUSE ed Edition

    ON ac.current_code = ed.unit

    Join IN-HOUSE int_tab t

    ON ed.process_no = t.action_no

    WHERE t.icode! = ac.icode

    and t.icode is not null) source

    on (target.rowid = source.id)

    WHEN MATCHED

    THEN UPDATE set target.icode = source.icode;

  • Update statement with multiple joints

    Hello

    I use Oracle 12 c and here my Question:

    /*

    ledgerstb is an Oracle the ITO (TransNo column is the primary key)

    vledgerstb_gtt is a global temporary Table

    vledgervc_gtt is a global temporary Table

    */

    UPDATE

    (, SELECT ledgerstb. TransNoVC AS TransNoVC_Old,

    vledgervc_gtt.transnovc AS TransNoVC_New

    OF ledgerstb

    INNER JOIN vledgerstb_gtt ON ledgerstb. TransNo = vledgerstb_gtt.transnostb

    INNER JOIN vledgervc_gtt ON ledgerstb. STBNo = vledgervc_gtt. STBNo

    ) T

    SET T.TransNoVC_OLD = T.TransNoVC_NEW;

    This update statement gives the following error message:

    Error report-

    ORA-01779: cannot modify a column that is mapped to a table not preserved key

    ORA-06512: at "RELYC. STBPKG', line 597

    ORA-06512: at line 201 level

    01779 00000 - 'impossible to change a column that is mapped to a non-preserved table at key'

    * Cause: An attempt was made to insert or update columns in a join finds out who

    map to a table not kept the key.

    * Action: Change the directly underlying base tables.

    For your reference, the following result internal instruction select (in blue color police) give;

    TransNo: 1 STBNo: VAAAABM315711131

    TransNo: STBNo 2: VAAAABM315711214

    TransNo: STBNo 3: VAAAABM315711262

    TransNo: STBNo 4: VAAAABM316410986

    Please suggest if I'm doing something wrong or it is not possible to update the table like that.

    (I know that I can use ForAll Update statement, but I do not want to use Collections here.)

    Thank you carine, finally I found my answer,

    the update query requires that each record that will be updated should be updated only once. so if I do join 1<->1 it updates successfully.

    Thanks to all who contributed, or at least tried. Thanks again.

  • the update statement modidy

    Hi all

    I have here is the update statement in my code

    UPDATE equip_stg stg

    SET stg.err = 'WRC '.

    WHERE DOES NOT EXIST (SELECT *)

    FROM (SELECT stg.*

    Of equip_stg stg.

    REASON_SETUP sea

    WHERE stg.equipment_fk = mer.equipment_pk

    AND stg.downtime_reason_code = mer.reason_code

    AND ((stg.status = 3 AND sea. REASON_TYPE = 1)

    OR (stg.status = 2 AND sea. REASON_TYPE = 3)

    OR (stg.status = 1 AND sea. REASON_TYPE = 4))

    ERS stg.downtime_reason_code AND IS NOT NULL)

    WHERE ers.equipment_fk = stg.equipment_fk

    AND ers.downtime_reason_code = stg.downtime_reason_code

    )

    AND stg.status IN (3,2,1)

    AND stg.downtime_reason_code IS NOT NULL;

    The statement above sets updated the column equip_stg in WRC if err for corresponding material and reason, there is no line in the REASON_SETUP table.

    I want to change the code above so that the validation above is first done with REASON_SETUP according to equipment and column of type of reason. Is there is no line for this type of material and the reason in this table, then he must hit lookup table.  Example, I have data from equipment EQP1, status = 3, then it should check if REASON_SETUP has everything save for EQP1 equipment and the reasoning of type 1. If she made the next record should be validated on the table otherwise come file should be validated against the lookup table. For the table of choice also I have same join conditions

    STG.equipment_fk = lookup.equipment_pk

    AND stg.downtime_reason_code = lookup.reason_code

    Thanks in advance.

    Kind regards

    Amrit

    Hello

    I think I see.  All lines for each (equipment, reason_type) will be removed completely on a table or another. reason_setup if possible and looking as if this combination never occurs in reason_type.  Another way to say it is that you want only (equipment, reason_type) groups of the best tablle, where reason_type is better than search.  Exactly what made a Request Top - N .  Here's a way to do it:

    UPDATE equip_stg

    SET err_code = "WRC".

    WHERE (equipment, downtime_reason_code) NOT IN

    (

    WITH union_data AS

    (

    SELECT 'A' preference AS, reason_code, reason_type, equipment

    OF reason_setup

    UNION ALL

    SELECT equipment, reason_type, reason_code, 'B' AS preferences

    SEARCH

    )

    got_r_num AS

    (

    SELECT equipment, reason_type, reason_code

    DENSE_RANK () (PARTITION BY MATERIAL, reason_type

    ORDER OF preference

    ) AS r_num

    Of union_data

    )

    SELECT equipment

    DECODE (reason_type

    1, 3

    3, 2

    )

    reason_code

    OF got_r_num

    WHERE r_num = 1

    )

    ;

    To see how this works, reconstruction of the NOT IN subquery, step by step.  First run just union_data as a stand-alone application.  When you understand what it does, run got_r_num and when you see what he's doing, run the set NOT IN subquery.

  • Update statement is a coherent lof 'Get '.

    Hello

    When I run this update statement, it generates a lot of 'get in line ':

    UPDATE PFA_FUSIONFACC WAS

    SET (COD_FACTURA, TOT_CARGO_DB, TOT_CARGO_FB) =

    (SELECT THE NPC. COD_FACTUcaRA AS COD_FACTURA, NPC. TOT_BASEIMPO_E AS TOT_BASEIMPO, NPC. TOT_IMPEMI AS TOT_IMPEMI

    OF NPC, CTA AUX_CTAFACTU PFA_NPCOFACTMES

    where LTC. CTA_FACTURAC = WAS. CTA_FACTURAC

    AND NPC.cod_postal = CTA.cod_postal

    AND NPC.cta_facturac = CTA.cta_facturac)

    where FUS.rowid in

    (SELECT WAS.) ROWID

    NPC PFA_NPCOFACTMES, CTA AUX_CTAFACTU, WAS PFA_FUSIONFACC

    where LTC. CTA_FACTURAC = WAS. CTA_FACTURAC

    AND NPC.cod_postal = CTA.cod_postal

    AND NPC.cta_facturac = CTA.cta_facturac

    AND ROWNUM < 10000);

    9999 filas actualizadas.

    Passed: 01:38:15.47

    Run plan

    ----------------------------------------------------------

    Hash value of plan: 2048200947

    ----------------------------------------------------------------------------------------------------------------------------------

    | ID | Operation | Name                | Lines | Bytes | TempSpc | Cost (% CPU). Time | Pstart. Pstop |

    ----------------------------------------------------------------------------------------------------------------------------------

    |   0 | UPDATE STATEMENT.                     |     1.    62.       |   117 KB (4) | 00:23:27 |       |       |

    |   1.  UPDATE                            | PFA_FUSIONFACC |       |       |       |            |          |       |       |

    |   2.   NESTED LOOPS |                     |     1.    62.       |   117 KB (4) | 00:23:27 |       |       |

    |   3.    VIEW                            | VW_NSO_1 |  9999 |   117 KB |       |   117 KB (4) | 00:23:27 |       |       |

    |   4.     UNIQUE FATE |                     |     1.   478K |       |            |          |       |       |

    |*  5 |      COUNT STOPKEY |                     |       |       |       |            |          |       |       |

    |*  6 |       HASH JOIN |                     |   774K |    36 M |    86 M |   117 KB (4) | 00:23:27 |       |       |

    |   7.        NESTED LOOPS |                     |  2258K |    60 M |       |   101K (4) | 00:20:16 |       |       |

    |   8.         RANGE OF PARTITION ALL THE |                     |  2258K |    32 M |       |  2554 (2) | 00:00:31 |     1.   338.

    |   9.          FULL RESTRICTED INDEX SCAN FAST | PFA_NPCOFACTMES_103 |  2258K |    32 M |       |  2554 (2) | 00:00:31 |     1.   338.

    | * 10 |         INDEX UNIQUE SCAN | PK_AUX_CTAFACTU |     1.    13.       |     2 (0) | 00:00:01 |       |       |

    |  11.        FULL RESTRICTED INDEX SCAN FAST | PFA_FUSIONFACC_I01 |  3923K |    78 M |       |  5358 (2) | 00:01:05 |       |       |

    |  12.    TABLE ACCESS BY ROWID USER | PFA_FUSIONFACC |     1.    50.       |     1 (0) | 00:00:01 |       |       |

    |  13.   TABLE ACCESS BY LOCAL INDEX ROWID | PFA_NPCOFACTMES |     1.    56.       |     2 (0) | 00:00:01 |     1.     1.

    |  14.    NESTED LOOPS |                     |     1.    69.       |    49 (0) | 00:00:01 |       |       |

    | * 15 |     INDEX SKIP SCAN | PK_AUX_CTAFACTU |     1.    13.       |    47 (0) | 00:00:01 |       |       |

    |  16.     RANGE OF PARTITION ITERATOR.                     |     1.       |       |     1 (0) | 00:00:01 |   KEY |   KEY |

    | * 17.      INDEX RANGE SCAN | PFA_NPCOFACTMES_103 |     1.       |       |     1 (0) | 00:00:01 |   KEY |   KEY |

    ----------------------------------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    5 - filter(ROWNUM<10000)

    6 - access("CTA".") CTA_FACTURAC "=" WAS ". ("' CTA_FACTURAC")

    10 - access("NPC".") COD_POSTAL "=" CTA ". "" COD_POSTAL "AND"NPC ". "" CTA_FACTURAC "=" CTA ". ("' CTA_FACTURAC")

    15 - access("CTA".") CTA_FACTURAC "(=:B1)"

    filter ("CTA". "CTA_FACTURAC"(=:B1) "

    17 - access("NPC".") COD_POSTAL "=" CTA ". "" COD_POSTAL "AND"NPC ". "CTA_FACTURAC"(=:B1) "

    filter ("NPC". "" CTA_FACTURAC "=" CTA ". ("' CTA_FACTURAC")

    And statistics

    ----------------------------------------------------------

    1 recursive calls

    13252 db block Gets

    200711795 compatible Gets

    407276 physical reads

    Redo 3550216 size

    837 bytes sent via SQL * Net to client

    1320 bytes received via SQL * Net from client

    3 SQL * Net back and forth to and from the client

    2 sorts (memory)

    0 sorts (disk)

    9999 rows processed

    Rollback Terminado.

    But the query used by the update is much less "gets":

    SQL > SELECT WAS. ROWID

    NPC PFA_NPCOFACTMES, CTA AUX_CTAFACTU, WAS PFA_FUSIONFACC

    2 where 3 DEC. CTA_FACTURAC = WAS. CTA_FACTURAC

    AND NPC.cod_postal = CTA.cod_postal

    4 5 AND NPC.cta_facturac = CTA.cta_facturac

    AND ROWNUM < 10000 6;

    9999 filas seleccionadas.

    Passed: 00:00:20.57

    Run plan

    ----------------------------------------------------------

    Hash value of plan: 20234272

    -----------------------------------------------------------------------------------------------------------------------

    | ID | Operation | Name                | Lines | Bytes | TempSpc | Cost (% CPU). Time | Pstart. Pstop |

    -----------------------------------------------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |                     |  9999 |   937K |       | 29298 (2) | 00:05:52 |       |       |

    |*  1 |  COUNT STOPKEY |                     |       |       |       |            |          |       |       |

    |*  2 |   HASH JOIN |                     |   774K |    70 M |    58 M | 29298 (2) | 00:05:52 |       |       |

    |   3.    RANGE OF PARTITION ALL THE |                     |  2258K |    32 M |       |  2554 (2) | 00:00:31 |     1.   338.

    |   4.     FULL RESTRICTED INDEX SCAN FAST | PFA_NPCOFACTMES_103 |  2258K |    32 M |       |  2554 (2) | 00:00:31 |     1.   338.

    |*  5 |    HASH JOIN |                     |  3906K |   175 M |   123 M | 12842 (2) | 00:02:35 |       |       |

    |   6.     FULL RESTRICTED INDEX SCAN FAST | PFA_FUSIONFACC_I01 |  3923K |    78 M |       |  5358 (2) | 00:01:05 |       |       |

    |   7.     FULL RESTRICTED INDEX SCAN FAST | PK_AUX_CTAFACTU |   147K |  1869K |       |  1120 (1) | 00:00:14 |       |       |

    -----------------------------------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    1 - filter(ROWNUM<10000)

    2 - access("NPC".") COD_POSTAL "=" CTA ". "" COD_POSTAL "AND"NPC ". "" CTA_FACTURAC "=" CTA ". ("' CTA_FACTURAC")

    5 - access("CTA".") CTA_FACTURAC "=" WAS ". ("' CTA_FACTURAC")

    And statistics

    ----------------------------------------------------------

    1 recursive calls

    0 db block Gets

    54736 compatible Gets

    53070 physical readings

    0 redo size

    304491 bytes sent via SQL * Net to client

    7814 bytes received via SQL * Net from client

    668 SQL * Net back and forth to and from the client

    0 sorts (memory)

    0 sorts (disk)

    9999 rows processed

    The "PFA_NPCOFACTMES_103" index is partitioned. I don't know if it's related to this issue:

    SQL > select table_name, uniqueness, separated from all_indexes where index-name = "PFA_NPCOFACTMES_103";

    TABLE_NAME UNIQUENES BY

    ------------------------------ --------- ---

    PFA_NPCOFACTMES NON-UNIQUE YES

    SQL > select TABLE_NAME, COLUMN_NAME, position_colonne from all_ind_columns where index-name = "PFA_NPCOFACTMES_103";

    TABLE_NAME COLUMN_NAME POSITION_COLONNE

    ------------------------------ ------------------------------ ---------------

    PFA_NPCOFACTMES CTA_FACTURAC 2

    PFA_NPCOFACTMES COD_POSTAL 1

    Why the update does not generate as much "becomes"?

    Thanks in advance,

    Jose Luis

    I don't know the reason why at first sight, but it is obvious that the inner nested loop was doing a lot of work (full index scan).

    My first thought was to rewrite the query in a merge statement.

    Perhaps leads to a more effective plan and so no need to delve deeper into the issues you have raised ;-)

    merge into FUS PFA_FUSIONFACC

    a_l'_aide_de)

    SELECT

    NPC. COD_FACTUcaRA AS COD_FACTURA

    NPC. TOT_BASEIMPO_E AS TOT_BASEIMPO

    NPC. TOT_IMPEMI AS TOT_IMPEMI

    OF NPC, CTA AUX_CTAFACTU PFA_NPCOFACTMES

    where

    NPC.cod_postal = CTA.cod_postal

    AND NPC.cta_facturac = CTA.cta_facturac

    ) cta

    (TBT. CTA_FACTURAC = WAS. CTA_FACTURAC)

    When matched then update

    Was SET. COD_FACTURA = cta. COD_FACTURA

    was. TOT_CARGO_DB = cta. TOT_BASEIMPO

    was. TOT_CARGO_FB) = cta. TOT_IMPEMI

    where ROWNUM<>

  • Fix my update statement

    Hello

    Please correct my update statement,

    If I question the statement below.

    SELECT UP.COMPANY_ID

    OF USR_GRP_PROFILE

    U OF USERS,

    MAP C,

    THIS CARD_EXTN,

    COM OF THE COMPANY,

    COMPANY LOGICAL_COMP

    WHERE THIS. STATUS_E_STATEMENT AS 'U '.

    AND THIS. CARD_ID = C.CARD_ID

    AND U.USER_ID = C.USER_ID

    AND U.PROFILE_ID = UPWARD. PROFILE_ID

    AND UP.COMPANY_ID = COM.COMPANY_ID

    AND LOGICAL_COMP.COMPANY_ID = COM LOGICAL_COMPANY_ID

    o/p:

    175709

    164853

    175709

    164853

    The company_id above should be updated as "185994" How do I?

    The update below does not work properly., so correct my update statement

    UPDATE USR_GRP_PROFILE TO THE TOP OF UP.COMPANY_ID = 185994 SET

    IN (SELECT UP.COMPANY_ID

    OF USR_GRP_PROFILE

    U OF USERS,

    MAP C,

    THIS CARD_EXTN,

    COM OF THE COMPANY,

    COMPANY LOGICAL_COMP

    WHERE THIS. STATUS_E_STATEMENT AS 'U '.

    AND THIS. CARD_ID = C.CARD_ID

    AND U.USER_ID = C.USER_ID

    AND U.PROFILE_ID = UPWARD. PROFILE_ID

    AND UP.COMPANY_ID = COM.COMPANY_ID

    AND LOGICAL_COMP.COMPANY_ID = COM. LOGICAL_COMPANY_ID);

    Thank you

    Sailesh

    You're close, you need a where clause clause.  Something like:

    UPDATE USR_GRP_PROFILE TO THE TOP

    SET UP.COMPANY_ID = 185994

    where company_id IN (SELECT UP.COMPANY_ID

    OF USR_GRP_PROFILE

    U OF USERS,

    MAP C,

    THIS CARD_EXTN,

    COM OF THE COMPANY,

    COMPANY LOGICAL_COMP

    WHERE THIS. STATUS_E_STATEMENT AS 'U '.

    AND THIS. CARD_ID = C.CARD_ID

    AND U.USER_ID = C.USER_ID

    AND U.PROFILE_ID = UPWARD. PROFILE_ID

    AND UP.COMPANY_ID = COM.COMPANY_ID

    AND LOGICAL_COMP.COMPANY_ID = COM. LOGICAL_COMPANY_ID);

    John

  • Select Max (Date) in two different tables...

    Dear all,

    I need the date of last update of two different tables, I mean max (date). We will update one table at a time. Updated once I need to take the last update.

    It can be either in table A table B.

    for example.

    Table A

    Date of the ID

    100 16/05/2014

    101 20/05/2014

    102, 22/05/2014

    Table B

    Date of the ID

    100 04/06/2014

    101, 26/05/2014

    102 21/05/2014

    I need the date of table B (101 26/05/2014) last updated date...

    Hello

    Another way, using much more GRAND:

    SELECT LARGER (max1, max2) x

    FROM (SELECT MAX (mydate) max1

    OF mytable_a

    )

    (SELECT MAX (myotherdate) max2

    OF mytable_b

    )

    ;

    Best regards

    Bruno Vroman.

  • Select Max (date) multiple records

    I'm having a problem getting the last value for several gauges.  Here's my query:

    SELECT parameter_id,

    TS_ID,

    value,

    Location_id,

    Date_Time

    Of

    MyTable

    JOIN IN-HOUSE

    mytable2

    WE

    TS_ID = ts_id

    WHERE

    TS_ID LIKE '% - rev.

    unit_id = ("pi")

    the value IS NOT NULL

    Location_id as "xxxx".

    Date_Time =

    (SELECT Max (date_time)

    My TABLE

    GROUP BY parameter_id)

    ;

    Hello

    A scalar subquery, such as the expression to the right of the sign =

    Date_Time = (SELECT...)

    must produce (at most) only 1 row.  If the subquery produces 2 or more lines, it will trigger an error.

    Given that you are using "GROUP BY parameter_id" in the subquery, it will produce a separate line of output for each distinct value of parameter_id.  You can use a correlated subquery at that time, that only looks like a parameter_id, or you can use a subquery IN, like this:

    WHERE (parameter_id, Date_Time) IN

    (

    SELECT parameter_id

    MAX (date_time)

    FROM MyTable

    GROUP BY parameter_id

    )

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

  • Update, and select from the same table

    Hello

    I have this selection - I've tested and work

    [code]

    Select
    case
    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTBT
    of other DTF_REEW_201301.KTBT - CTF_REEW_KUM_201301.KTBT
    end

    as KTBT_ISO,

    case
    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTZN
    of other DTF_REEW_201301.KTZN - CTF_REEW_KUM_201301.KTZN
    end

    as KTZN_ISO,

    case
    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTAB
    of other DTF_REEW_201301.KTAB - CTF_REEW_KUM_201301.KTAB

    end as KTAB_ISO,

    DTF_REEW_201301.brnrn,
    DTF_REEW_201301.ktat

    Of

    reewcore. CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,
    reewdq. DTF_REEW_201301 DTF_REEW_201301

    where

    (DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN
    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT)
    and CTF_REEW_KUM_201301.KTMO = (DTF_REEW_201301.KTMO - 1).

    [/ code]

    With the result of KTBT_ISO, KTZN_ISO and KTAB_ISO I want to update the table 'reewdq. DTF_REEW_201301' - and this picture is in the select statement.

    I think I've tried every update statement - but no update does not work.

    I need something like this:

    [code]

    Update reewdq. DTF_REEW_201301 set t1 t1. KTBT_ISO =

    (

    Select
    case
    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTBT
    of other DTF_REEW_201301.KTBT - CTF_REEW_KUM_201301.KTBT
    end
    as KTBT_ISO

    Of

    reewcore. CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,
    reewdq. DTF_REEW_201301 DTF_REEW_201301

    where

    (DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN
    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT)
    and CTF_REEW_KUM_201301.KTMO = (DTF_REEW_201301.KTMO - 1).

    ),

    T1. KTZN_ISO =

    (

    Select

    case
    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTZN
    of other DTF_REEW_201301.KTZN - CTF_REEW_KUM_201301.KTZN
    end
    as KTZN_ISO

    Of

    reewcore. CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,
    reewdq. DTF_REEW_201301 DTF_REEW_201301

    where

    (DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN
    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT)
    and CTF_REEW_KUM_201301.KTMO = (DTF_REEW_201301.KTMO - 1).

    ),

    T1. KTAB_ISO =

    (

    Select
    case
    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTAB
    of other DTF_REEW_201301.KTAB - CTF_REEW_KUM_201301.KTAB
    end as KTAB_ISO

    Of

    reewcore. CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,
    reewdq. DTF_REEW_201301 DTF_REEW_201301

    where

    (DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN
    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT)
    and CTF_REEW_KUM_201301.KTMO = (DTF_REEW_201301.KTMO - 1).

    )

    [/ code]

    But this isn´t of the labour code. Someone an idea please? Can someone help me please.

    Best regards

    Heidi

    Use MERGE:

    Fusion

    in reewdq. DTF_REEW_201301 t1

    a_l'_aide_de)

    Select the case sensitive option

    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTBT

    of other DTF_REEW_201301.KTBT - CTF_REEW_KUM_201301.KTBT

    end as KTBT_ISO,

    case

    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTZN

    of other DTF_REEW_201301.KTZN - CTF_REEW_KUM_201301.KTZN

    end as KTZN_ISO,

    case

    When DTF_REEW_201301.KTMO = 1 then DTF_REEW_201301.KTAB

    of other DTF_REEW_201301.KTAB - CTF_REEW_KUM_201301.KTAB

    end as KTAB_ISO,

    reewdq. ROWID that RID

    of reewcore. CTF_REEW_KUM_201301 CTF_REEW_KUM_201301,

    reewdq. DTF_REEW_201301 DTF_REEW_201301

    where DTF_REEW_201301.BRNRN = CTF_REEW_KUM_201301.BRNRN

    and DTF_REEW_201301.KTAT = CTF_REEW_KUM_201301.KTAT

    and CTF_REEW_KUM_201301.KTMO = DTF_REEW_201301.KTMO - 1

    ) t2

    on)

    T1. ROWID = t2.rid

    )

    When Fachhochschule

    then

    Update

    the t1 value. KTBT_ISO = t2. KTBT_ISO,

    T1. KTZN_ISO = t2. KTZN_ISO,

    T1. KTAB_ISO = t2. KTAB_ISO

    /

    SY.

Maybe you are looking for

  • Flickering on Netflix after update of the Sierra

    Since the update of my MBP 13 yesterday, there is a massive amount of flicker watching Netflix mode full-screen.   Update of Silverlight has not solved the problem. Does anyone have a possible solution for this? Thank you

  • iPhone 7 delivery date.

    Hello I ordered a 7 IPhone. the delivery times were "September." Is it confirmed that it is to come in September rather than November?

  • HPE180T CTO: HPE 180 t graphics card advise?

    Recently, I improved my diet at 650W, installed a 660Ti GTX card and had nothing but problems. I did everything as suggested here and elsewhere. I updated the Bios, used DDU, reformatted and reinstalled my OS. Tried on older drivers, the most recent,

  • Upgrade Express Toshiba Media Player

    HI :) Who have or where is software upgrade Express media player 2.0 rev.I have a M45 - s355 Express ver 1.1 MP (hidden this software partition is 204 Mb)

  • Lenovo X120e in trouble with the system update

    Hi, I am building a brand new X120e (0596) with an AMD E-350, 4 GB of RAM I have loaded with X 64 Win 7 Enterprise. Everything is fine, but whenever I try to run the Lenovo system update I get the message: "the server to update the system is currentl