Query UPDATE with applied logic

Hi Experts,

I need your help for now. Here is my requirement,
BANNER                                                                          
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production          
PL/SQL Release 11.1.0.7.0 - Production                                          
CORE     11.1.0.7.0     Production                                                      
TNS for 32-bit Windows: Version 11.1.0.7.0 - Production                         
NLSRTL Version 11.1.0.7.0 - Production                                          
5 rows selected.
DROP TABLE LINE_STATUS;
DROP TABLE LINE_CHILD;
CREATE TABLE LINE_STATUS
(
    LINE_ID     INTEGER     NOT NULL PRIMARY KEY,
    LINE_AMT    FLOAT,
    LINE_FLAG   INTEGER
);

INSERT INTO LINE_STATUS VALUES(1,1.52,0);
INSERT INTO LINE_STATUS VALUES(2,1.06,0);
INSERT INTO LINE_STATUS VALUES(3,2.05,0);

CREATE TABLE LINE_CHILD
(
    LINECHILD_ID        INTEGER NOT NULL PRIMARY KEY,
    LINECHILD_LINEID    INTEGER NOT NULL,
    LINECHILD_AMT       FLOAT
);

INSERT INTO LINE_CHILD VALUES (100,1,0.50);
INSERT INTO LINE_CHILD VALUES (101,1,0.50);
INSERT INTO LINE_CHILD VALUES (102,2,1.00);
INSERT INTO LINE_CHILD VALUES (103,2,0.05);
NOW I NEED TO COLLECT THE SUM OF LINECHILD_AMT FOR EACH LINECHILD_LINEID, CONSULT LINE_STATUS (LINE_ID) AND CHECK
THE VALUES ARE THE SAME, IT CAN HAVE DIFFERENCE 0.01 THEN TO VALUE LINE_STATUS (LINE_FLAG) UPDATE.

For example:
SELECT SUM (LINECHILD_AMT) FROM LINE_CHILD WHERE LINECHILD_LINEID = 1
1, the result is
 
CASE 
    WHEN LINE_STATUS(LINE_AMT)!=SUM(LINECHILD_AMT) THEN 2
    WHEN LINE_STATUS(LINE_AMT) =(LINE_STATUS(LINE_AMT)<=-0.01 OR LINE_STATUS(LINE_AMT)>=0.01 THEN 1
END CASE <<RESULT>>
UPDATED LINE_STATUS, LINE_CHILD SET LINE_FLAG = BOX < < RESULT > > WHERE LINECHILD_LINEID = LINE_ID;

How can I achieve this?

Thank you

You should try it yourself using the above post. Anyway, so really, you cannot then use the below mentioned updated.

UPDATE LINE_STATUS
SET LINE_FLAG=( WITH Sum_Line_Status AS ( SELECT LINE_ID S_LINE_ID,SUM(LINE_AMT) LINE_AMT_SUM
                                          FROM LINE_STATUS
                                          GROUP BY LINE_ID
                                        )
                ,Sum_LINE_CHILD AS ( SELECT LINECHILD_LINEID S_LINECHILD_LINEID,
                                     SUM(LINECHILD_AMT) LINECHILD_AMT_SUM
                                     FROM LINE_CHILD
                                     GROUP BY  LINECHILD_LINEID
                                   )

                  SELECT
                     CASE
                         ----When SUM are exactlly equal or difference is less than equal 0.01
                         WHEN (LINE_AMT_SUM=LINECHILD_AMT_SUM )
                              OR (ABS(LINE_AMT_SUM-LINECHILD_AMT_SUM)<=0.01)
                          THEN 1
                         ----When SUM are NOT equal or difference is more than equal 0.01
                         WHEN ABS(LINE_AMT_SUM-LINECHILD_AMT_SUM)>0.01 THEN 2

                     END
                  FROM   Sum_Line_Status,Sum_LINE_CHILD
                  WHERE  S_LINE_ID=S_LINECHILD_LINEID
                  AND  S_LINE_ID=LINE_ID
                  )

Tags: Database

Similar Questions

  • At what stage of the treatment we use a rule to update to apply logic to the way the data are updated in the database?

    Hello

    At what stage of treatment do you use a rule to update to apply logic to the way the data are updated in the database?

    Rahul

    Hello Rahul,

    Update the existing record or a data object

    Thank you

    edynamic expert Eloqua

  • my iphone 5 c opens more after that I was invited to be updated with itunes. now, the display shows only itunes usb cable and logo. read some tips here, but nothing happened. any help will be much appreciated.

    My iPhone 5 c opens more after that I was invited to be updated with iTunes. now the display shows iTunes logo and the USB cable. I have read and applied some tips here, but nothing happened. Any help will be much appreciated. Thank you.

    https://discussions.Apple.com/message/30014877#30014877http ://

    Read the post from sierrawren . It helped me to fix my phone. Now it works perfectly fine. Hope it can help others too.

  • Had to do a restoration complete my xp machine and will not update, in the past, system automatically updated with cartridges of siema etc service?

    Had to do a restoration complete my xp machine and will not update, in the past, system automatically updated with cartridges of siema etc service?

    What is happening, it is that it is so more the possibility of a user friendly hands on automatic update of Windows XP from a clean install.  Windows Update will NOT synchronize with and updated in the current order status to update a machine with a clean install of XP, but you separately download some patches and intermediate updates and apply them manually, to have a machine that connects a bit normally with Windows Update.

    Install the last update cumulative security for the version of Internet Explorer you have currently is essential, and you need to download separately and install it before going any further.

    http://support.Microsoft.com/kb/2888505

    Scroll to the information file for XP and Server 2003

    Download the file corresponding to your version of Internet Explorer and install first.

    It is also highly recommended that you install Firefox because IE8 is limited, probably compromised and sometimes useless and will crash on many sites, including Microsoft sites, including linked just above.

  • Windows Update driver Fresco Logic USB Hub rot caused the pilot to read device status: the drivers for this device are not installed. (Code 28).

    Windows Update driver Fresco Logic USB Hub rot caused the pilot to read device status: the drivers for this device are not installed. (Code 28). The Roll Back button is not active. Where can I get the previous driver that came with my system. ASUS N53S Windows 7. Thank you very much.

    Hello

    Thanks for posting in the Microsoft Community.

    I understand your annoyance that you cannot update the driver hub USB rot. Please follow the steps below to help you to solve the problem.

    I would like to inform you that a Code 28 error is caused by a driver missing for that piece of hardware.

    There are all sorts of reasons that a driver could not be installed for a device, but your troubleshooting the problem will be the same regardless of the root cause.

    • Remove or reconfigure newly installed unit.
    • Restore the version before your driver update.
    • Use system restore to undo recent changes in Device Manager.

    Step 1: Roll back the driver to the version before your update.

    If you are having problems with your computer or device after upgrading sound driver, you can restore to an earlier device driver. If you are having problems with your computer or device after upgrading sound driver, you can restore to an earlier device driver. If you are having problems with your computer or device after upgrading sound driver, you can restore to an earlier device driver. If you are having problems with your computer or device after upgrading sound driver, you can restore to an earlier device driver. Check out the link below to make back the driver:

    http://Windows.Microsoft.com/en-in/Windows/restore-driver-previous-version#1TC=Windows-7

    When Windows 7 starts up again, it will load with the device driver of this material that you had previously installed.

    I suggest you to uninstall the driver from hub to rot Fresco Logic USB Device Manager and install the most recent on the manufacturer's Web site.

    Tips for solving common driver problems:

    http://Windows.Microsoft.com/en-us/Windows7/tips-for-fixing-common-driver-problems

     

     

    Hope this information is useful. Feel free to get back to us for further questions or problems related to the Windows operating system.

    Thank you.

  • My Iphone will not update with itunes.

    My Iphone will not update with itunes. He hit a certain part and it's downloading but everything freezes, I can't it never ends downlaoding my photos or anthing. Also, my itunes does not connect to the itunes store.

    Original title: program compatibility Application Applications App Apps game games Legacy Crash crashes Hang hangs

    Hello

    Thanks for posting your query in the Microsoft Community Forums.

    The question you posted would be better suited in the ITunes Forums. I would refer you to the ITunes support link and check if it helps.

    ITunes - Support
    http://www.Apple.com/support/iTunes/

    See also: communities of Apple
    https://discussions.Apple.com/index.jspa

    Back to us for any problem related to the Windows operating system. We will be happy to help you. We at Microsoft try to provide our customers the best experience.

  • Help in the optimization of a query update

    Hi gurus,

    I'm trying to optimize the query update on a large TT_TERM_HIST table below (table size is 13 GB).

    The update statement is supposed to update the lines ~ 7 M. Total number of lines are ~ 9 M.

    The TT_TERM table is also large (table size is 9.5 GB) and PK on column DEAL_NUM.

    UPDATE  tt_term_hist hist
       SET LOCAL_BANKING_SYSTEM19 =
              (SELECT LOCAL_BANKING_SYSTEM19
                 FROM tt_term tt
                WHERE tt.deal_num = hist.deal_num)
    WHERE hist.deal_num IN
              (SELECT deal_num
                 FROM tt_term
                WHERE SUBSTR (LOCAL_BANKING_SYSTEM19, 1, 5) IN
                         ('FT7FC', 'FT7MC', 'FT7TM')) ;
    

    Performance plan is as follows:

    
    -----------------------------------------------------------------------------------------------
    | Id  | Operation                    | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    -----------------------------------------------------------------------------------------------
    |   0 | UPDATE STATEMENT             |                |   266K|  6763K|  1756K (16)| 05:51:23 |
    |   1 |  UPDATE                      | TT_TERM_HIST   |       |       |            |          |
    |   2 |   NESTED LOOPS               |                |   266K|  6763K|   691K  (1)| 02:18:16 |
    |*  3 |    TABLE ACCESS FULL         | TT_TERM        | 44729 |   742K|   333K  (1)| 01:06:41 |
    |*  4 |    INDEX RANGE SCAN          | IRTERM_HIST_PK |     6 |    54 |     2   (0)| 00:00:01 |
    |   5 |   TABLE ACCESS BY INDEX ROWID| TT_TERM        |     1 |    17 |     3   (0)| 00:00:01 |
    |*  6 |    INDEX UNIQUE SCAN         | IRTERM_PK      |     1 |       |     2   (0)| 00:00:01 |
    -----------------------------------------------------------------------------------------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    
       3 - filter(SUBSTR("LOCAL_BANKING_SYSTEM19",1,5)='FT7FC' OR
                  SUBSTR("LOCAL_BANKING_SYSTEM19",1,5)='FT7MC' OR
                  SUBSTR("LOCAL_BANKING_SYSTEM19",1,5)='FT7TM')
       4 - access("HIST"."DEAL_NUM"="DEAL_NUM")
       6 - access("TT"."DEAL_NUM"=:B1)
    

    Then, I created a function-based index table TT_TERM using the function 'SUBSTR (LOCAL_BANKING_SYSTEM19, 1, 5)' and the plan amended as follows:

    -------------------------------------------------------------------------------------------------
    | Id  | Operation                      | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    -------------------------------------------------------------------------------------------------
    |   0 | UPDATE STATEMENT               |                | 89688 |  2364K|   480K (19)| 01:36:06 |
    |   1 |  UPDATE                        | TT_TERM_HIST   |       |       |            |          |
    |   2 |   NESTED LOOPS                 |                | 89688 |  2364K|   121K  (1)| 00:24:21 |
    |   3 |    INLIST ITERATOR             |                |       |       |            |          |
    |   4 |     TABLE ACCESS BY INDEX ROWID| TT_TERM        | 15060 |   264K|  1225   (0)| 00:00:15 |
    |*  5 |      INDEX RANGE SCAN          | CS_TERM_LBS19  |  6024 |       |    17   (0)| 00:00:01 |
    |*  6 |    INDEX RANGE SCAN            | IRTERM_HIST_PK |     6 |    54 |     2   (0)| 00:00:01 |
    |   7 |   TABLE ACCESS BY INDEX ROWID  | TT_TERM        |     1 |    17 |     3   (0)| 00:00:01 |
    |*  8 |    INDEX UNIQUE SCAN           | IRTERM_PK      |     1 |       |     2   (0)| 00:00:01 |
    -------------------------------------------------------------------------------------------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    
       5 - access(SUBSTR("LOCAL_BANKING_SYSTEM19",1,5)='FT7FC' OR
                  SUBSTR("LOCAL_BANKING_SYSTEM19",1,5)='FT7MC' OR
                  SUBSTR("LOCAL_BANKING_SYSTEM19",1,5)='FT7TM')
       6 - access("HIST"."DEAL_NUM"="DEAL_NUM")
       8 - access("TT"."DEAL_NUM"=:B1)
    

    Try to use the index PARALLEL is shooting to the high cost in Millions.

    UPDATE /*+ PARALLEL */ tt_term_hist hist
       SET LOCAL_BANKING_SYSTEM19 =
              (SELECT LOCAL_BANKING_SYSTEM19
                 FROM tt_term tt
                WHERE tt.deal_num = hist.deal_num)
    WHERE hist.deal_num IN
              (SELECT deal_num
                 FROM tt_term
                WHERE SUBSTR (LOCAL_BANKING_SYSTEM19, 1, 5) IN
                         ('FT7FC', 'FT7MC', 'FT7TM')) ;
    

    ----------------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                           | Name          | Rows  | Bytes | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
    ----------------------------------------------------------------------------------------------------------------------------------
    |   0 | UPDATE STATEMENT                    |               |  6096K|   156M|    24M (25)| 81:18:18 |        |      |            |
    |   1 |  UPDATE                             | TT_TERM_HIST  |       |       |            |          |        |      |            |
    |   2 |   PX COORDINATOR                    |               |       |       |            |          |        |      |            |
    |   3 |    PX SEND QC (RANDOM)              | :TQ10002      |  6096K|   156M|  4482   (1)| 00:00:54 |  Q1,02 | P->S | QC (RAND)  |
    |*  4 |     HASH JOIN BUFFERED              |               |  6096K|   156M|  4482   (1)| 00:00:54 |  Q1,02 | PCWP |            |
    |   5 |      BUFFER SORT                    |               |       |       |            |          |  Q1,02 | PCWC |            |
    |   6 |       PX RECEIVE                    |               |  1023K|    17M|  1225   (0)| 00:00:15 |  Q1,02 | PCWP |            |
    |   7 |        PX SEND HASH                 | :TQ10000      |  1023K|    17M|  1225   (0)| 00:00:15 |        | S->P | HASH       |
    |   8 |         INLIST ITERATOR             |               |       |       |            |          |        |      |            |
    |   9 |          TABLE ACCESS BY INDEX ROWID| TT_TERM       |  1023K|    17M|  1225   (0)| 00:00:15 |        |      |            |
    |* 10 |           INDEX RANGE SCAN          | CS_TERM_LBS19 |  6024 |       |    17   (0)| 00:00:01 |        |      |            |
    |  11 |      PX RECEIVE                     |               |  9007K|    77M|  3257   (1)| 00:00:40 |  Q1,02 | PCWP |            |
    |  12 |       PX SEND HASH                  | :TQ10001      |  9007K|    77M|  3257   (1)| 00:00:40 |  Q1,01 | P->P | HASH       |
    |  13 |        PX BLOCK ITERATOR            |               |  9007K|    77M|  3257   (1)| 00:00:40 |  Q1,01 | PCWC |            |
    |  14 |         TABLE ACCESS FULL           | TT_TERM_HIST  |  9007K|    77M|  3257   (1)| 00:00:40 |  Q1,01 | PCWP |            |
    |  15 |   TABLE ACCESS BY INDEX ROWID       | TT_TERM       |     1 |    17 |     3   (0)| 00:00:01 |        |      |            |
    |* 16 |    INDEX UNIQUE SCAN                | IRTERM_PK     |     1 |       |     2   (0)| 00:00:01 |        |      |            |
    ----------------------------------------------------------------------------------------------------------------------------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    
       4 - access("HIST"."DEAL_NUM"="DEAL_NUM")
      10 - access(SUBSTR("LOCAL_BANKING_SYSTEM19",1,5)='FT7FC' OR SUBSTR("LOCAL_BANKING_SYSTEM19",1,5)='FT7MC' OR
                  SUBSTR("LOCAL_BANKING_SYSTEM19",1,5)='FT7TM')
      16 - access("TT"."DEAL_NUM"=:B1)
    

    The Pb, I train of CARS with 2 nodes. DB version details are as follows:

    SQL> select banner from v$version;
    Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    PL/SQL Release 11.2.0.4.0 - Production
    CORE    11.2.0.4.0      Production
    TNS for Linux: Version 11.2.0.4.0 - Production
    NLSRTL Version 11.2.0.4.0 - Production
    

    Please let know us your opinion on how to optimize the query. Please let me know in case you need other inputs.

    Hello

    "The update statement is supposed to update the lines ~ 7 M." "Total number of lines are ~ 9 M."
    Could specify total number by each table? It makes sense to use "hash join" to join table?
    Try to replace 'in' also exists.

    You can try to update the join, it might help to exclude a single step to join as:

    UPDATE ( SELECT HIST.LOCAL_BANKING_SYSTEM19 OLD_VAL , TT.LOCAL_BANKING_SYSTEM19 NEW_VAL
               FROM TT_TERM_HIST HIST, TT_TERM TT
              WHERE TT.DEAL_NUM = HIST.DEAL_NUM
                AND SUBSTR (LOCAL_BANKING_SYSTEM19, 1, 5) IN ('FT7FC', 'FT7MC', 'FT7TM')
           )
    SET OLD_VAL = NEW_VAL
    ;
    

    ! WARNING! It is just not tested sample.

    WBR,

  • Impossible to update with ESXUPDATE

    I get this error everytime I try to apply an update on my ESX 4 server...

    #esxupdate - update of ESX bundle - 4.0.0 - update01a.zip

    ESX - 4.0.0 - update01a.zip

    Encountered error FileIOError:

    The error data are:

    Filename - no

    Message - IO error (28) on the file: no space is available on the device

    Errno - 10

    Description - unable to create, write, or read a file as expected.

    FYI, the update is located in/var/updates

    Help is appreciated.

    Updated with:

    By using the command 'vdf h' to see how much free space is available on the hypervisor.

    #vdf h

    File system

    Size

    Used

    Avil

    % Of use

    Mounted on

    / dev/sdc5

    4.9 G

    4.9 G

    0

    100%

    /

    / dev/sdb1

    1.1 G

    75 M

    952 M

    8%

    / Boot

    / dev/sdb2

    2.0 G

    52 M

    1.8 G

    3%

    / var/log

    device/vmfs /.

    836G

    0

    836G

    1 D

    VMFS/devices

    / vmfs/volumes/4AE4...

    835G

    286G

    548G

    34%

    / vmfs/volumes/Storage1

    Post edited by: adminatater

    Yep, / is full.  delete all files/var/spool/esxupdate and/var/core, search for other files taking up lots of space.  check/root and /vmimages for the .iso files that may have been downloaded, too.

    Oops, ESX4.  Check/var/cache/esxupdate for update files previously cached, iirc.

    Post edited by: danm66

  • Update with INNER JOIN

    Hello

    My update with the inner join does not seem to work.

    UPDATE RECAP R SET R.FLAVOR = (SELECT FN. FLAVOR_NDC FN FLAVOR, REPLACE CAP R WHERE R.NDC11 = FN. NDC11)

    When I write the query above, the inner circle question (SELECT FN. FLAVOR_NDC FN FLAVOR, REPLACE CAP R WHERE R.NDC11 = FN. NDC11) returns multiple lines, and it's a new syntax for me (as I was Teradata and SQL server).

    Can you please how this request can be written to make it work?

    I get the error message below

    SQL error: ORA-01427: einreihig subquery returns multiple rows
    01427 00000 - "einreihig subquery returns several lines.

    1. fix your code:

    UPDATE RECAP R SET R.FLAVOR = (SELECT FN.FLAVOR FROM FLAVOR_NDC FN WHERE R.NDC11 = FN.NDC11)
    

    2. you can use the fusion

    merge into RECAP R
    using FLAVOR_NDC FN
    on(R.NDC11 = FN.NDC11)
    when matched then
         update
         set R.FLAVOR = FN.FLAVOR
    

    Kind regards
    Malakshinov Sayan

  • How to improve an update with a correlated subquery

    Hi all

    Could someone please some help or advice?
    I try to do the next update with correlated subquery to get all records from updatedl in the table PSI (700 k records)
    update /*+ parallel(psi 4) */ psi psi
    set PREMIERE_VENTE =
           (select min(eve.dateve) 
            from eve, evp 
            where eve.codsoc = evp.codsoc and eve.achvte = evp.achvte and eve.typeve = evp.typeve and eve.numeve = evp.numeve 
            and eve.codsoc = psi.num_mag and eve.achvte = 'V' and eve.typeve in('TIC','FAV') 
            and eve.dateve between '20090101' and '20091231' and evp.codpro = psi.ref_pro)
    Of course, it takes a long time to do the update. I tried to do in num_mag (I have 73 distinct values, and for each distinct value, I have about 9 k lines)
    and it took about 8 minutes, updating the 9000 lines. OK, that's a total of nearly 10 hours. But I need to run 15 similar updates and it's a lot of time.
    Not only that, but during the night, that we have a lot of running batches, so I am not able to run for 24/24.

    Here is the plan of the explain command:
    PLAN_TABLE_OUTPUT                                                                                                                                                                                                                                         
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 1857481200                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                              
    -----------------------------------------------------------------------------------------------------------------------------------------------------                                                                                                     
    | Id  | Operation                               | Name         | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |    TQ  |IN-OUT| PQ Distrib |                                                                                                     
    -----------------------------------------------------------------------------------------------------------------------------------------------------                                                                                                     
    |   0 | UPDATE STATEMENT                        |              |   704K|    15M|   583   (5)| 00:00:02 |       |       |        |      |            |                                                                                                     
    |   1 |  UPDATE                                 | PSI          |       |       |            |          |       |       |        |      |            |                                                                                                     
    |   2 |   PX COORDINATOR                        |              |       |       |            |          |       |       |        |      |            |                                                                                                     
    |   3 |    PX SEND QC (RANDOM)                  | :TQ10000     |   704K|    15M|   583   (5)| 00:00:02 |       |       |  Q1,00 | P->S | QC (RAND)  |                                                                                                     
    |   4 |     PX BLOCK ITERATOR                   |              |   704K|    15M|   583   (5)| 00:00:02 |       |       |  Q1,00 | PCWC |            |                                                                                                     
    |   5 |      TABLE ACCESS FULL                  | PSI          |   704K|    15M|   583   (5)| 00:00:02 |       |       |  Q1,00 | PCWP |            |                                                                                                     
    |   6 |   SORT AGGREGATE                        |              |     1 |    50 |            |          |       |       |        |      |            |                                                                                                     
    |*  7 |    HASH JOIN                            |              |     1 |    50 |    34   (3)| 00:00:01 |       |       |        |      |            |                                                                                                     
    |   8 |     PARTITION RANGE SINGLE              |              |    22 |   550 |    23   (0)| 00:00:01 |   KEY |   KEY |        |      |            |                                                                                                     
    |   9 |      PARTITION LIST SINGLE              |              |    22 |   550 |    23   (0)| 00:00:01 |   KEY |   KEY |        |      |            |                                                                                                     
    |  10 |       INLIST ITERATOR                   |              |       |       |            |          |       |       |        |      |            |                                                                                                     
    |  11 |        TABLE ACCESS BY LOCAL INDEX ROWID| EVP          |    22 |   550 |    23   (0)| 00:00:01 |   KEY |   KEY |        |      |            |                                                                                                     
    |* 12 |         INDEX RANGE SCAN                | PPP_EVP_IDX1 |     1 |       |     5   (0)| 00:00:01 |   KEY |   KEY |        |      |            |                                                                                                     
    |  13 |     PARTITION RANGE SINGLE              |              |    57 |  1425 |    10   (0)| 00:00:01 |   KEY |   KEY |        |      |            |                                                                                                     
    |  14 |      PARTITION LIST SINGLE              |              |    57 |  1425 |    10   (0)| 00:00:01 |   KEY |   KEY |        |      |            |                                                                                                     
    |  15 |       INLIST ITERATOR                   |              |       |       |            |          |       |       |        |      |            |                                                                                                     
    |  16 |        TABLE ACCESS BY LOCAL INDEX ROWID| EVE          |    57 |  1425 |    10   (0)| 00:00:01 |   KEY |   KEY |        |      |            |                                                                                                     
    |* 17 |         INDEX RANGE SCAN                | EVE_M_IDX1   |     1 |       |     4   (0)| 00:00:01 |   KEY |   KEY |        |      |            |                                                                                                     
    -----------------------------------------------------------------------------------------------------------------------------------------------------                                                                                                     
                                                                                                                                                                                                                                                              
    Query Block Name / Object Alias (identified by operation id):                                                                                                                                                                                             
    -------------------------------------------------------------                                                                                                                                                                                             
                                                                                                                                                                                                                                                              
       1 - UPD$1                                                                                                                                                                                                                                              
       5 - UPD$1 / PSI@UPD$1                                                                                                                                                                                                                                  
       6 - SEL$1                                                                                                                                                                                                                                              
      11 - SEL$1 / EVP@SEL$1                                                                                                                                                                                                                                  
      12 - SEL$1 / EVP@SEL$1                                                                                                                                                                                                                                  
      16 - SEL$1 / EVE@SEL$1                                                                                                                                                                                                                                  
      17 - SEL$1 / EVE@SEL$1                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                              
    Predicate Information (identified by operation id):                                                                                                                                                                                                       
    ---------------------------------------------------                                                                                                                                                                                                       
                                                                                                                                                                                                                                                              
       7 - access("EVE"."CODSOC"="EVP"."CODSOC" AND "EVE"."ACHVTE"="EVP"."ACHVTE" AND "EVE"."TYPEVE"="EVP"."TYPEVE" AND                                                                                                                                       
                  "EVE"."NUMEVE"="EVP"."NUMEVE")                                                                                                                                                                                                              
      12 - access("EVP"."CODSOC"=TO_NUMBER(:B1) AND "EVP"."ACHVTE"='V' AND ("EVP"."TYPEVE"='FAV' OR "EVP"."TYPEVE"='TIC') AND "EVP"."CODPRO"=:B2)                                                                                                             
      17 - access("EVE"."CODSOC"=TO_NUMBER(:B1) AND "EVE"."ACHVTE"='V' AND ("EVE"."TYPEVE"='FAV' OR "EVE"."TYPEVE"='TIC') AND                                                                                                                                 
                  "EVE"."DATEVE">='20090101' AND "EVE"."DATEVE"<='20091231')                                                                                                                                                                                  
           filter(SUBSTR("EVE"."DATEVE",1,6)>='200901' AND SUBSTR("EVE"."DATEVE",1,6)<='200912')                                                                                                                                                              
                                                                                                                                                                                                                                                              
    Column Projection Information (identified by operation id):                                                                                                                                                                                               
    -----------------------------------------------------------                                                                                                                                                                                               
                                                                                                                                                                                                                                                              
       2 - (upd=4; cmp=2,3) "SYS_ALIAS_2".ROWID[ROWID,10], "PSI"."NUM_MAG"[VARCHAR2,12], "PSI"."REF_PRO"[VARCHAR2,16],                                                                                                                                        
           "PREMIERE_VENTE"[CHARACTER,8]                                                                                                                                                                                                                      
       3 - (#keys=0) "SYS_ALIAS_2".ROWID[ROWID,10], "PSI"."NUM_MAG"[VARCHAR2,12], "PSI"."REF_PRO"[VARCHAR2,16], "PREMIERE_VENTE"[CHARACTER,8]                                                                                                                 
       4 - "SYS_ALIAS_2".ROWID[ROWID,10], "PSI"."NUM_MAG"[VARCHAR2,12], "PSI"."REF_PRO"[VARCHAR2,16], "PREMIERE_VENTE"[CHARACTER,8]                                                                                                                           
       5 - "SYS_ALIAS_2".ROWID[ROWID,10], "PSI"."NUM_MAG"[VARCHAR2,12], "PSI"."REF_PRO"[VARCHAR2,16], "PREMIERE_VENTE"[CHARACTER,8]                                                                                                                           
       6 - (#keys=0) MIN("EVE"."DATEVE")[8]                                                                                                                                                                                                                   
       7 - (#keys=4) "EVP"."CODSOC"[NUMBER,22], "EVE"."CODSOC"[NUMBER,22], "EVP"."ACHVTE"[VARCHAR2,1], "EVE"."ACHVTE"[VARCHAR2,1],                                                                                                                            
           "EVP"."TYPEVE"[VARCHAR2,3], "EVE"."TYPEVE"[VARCHAR2,3], "EVP"."NUMEVE"[NUMBER,22], "EVE"."NUMEVE"[NUMBER,22], "EVP".ROWID[ROWID,10],                                                                                                               
           "EVP"."CODPRO"[VARCHAR2,16], "EVE".ROWID[ROWID,10], "EVE"."DATEVE"[VARCHAR2,8]                                                                                                                                                                     
       8 - "EVP".ROWID[ROWID,10], "EVP"."ACHVTE"[VARCHAR2,1], "EVP"."TYPEVE"[VARCHAR2,3], "EVP"."NUMEVE"[NUMBER,22],                                                                                                                                          
           "EVP"."CODPRO"[VARCHAR2,16], "EVP"."CODSOC"[NUMBER,22]                                                                                                                                                                                             
       9 - "EVP".ROWID[ROWID,10], "EVP"."ACHVTE"[VARCHAR2,1], "EVP"."TYPEVE"[VARCHAR2,3], "EVP"."NUMEVE"[NUMBER,22],                                                                                                                                          
           "EVP"."CODPRO"[VARCHAR2,16], "EVP"."CODSOC"[NUMBER,22]                                                                                                                                                                                             
      10 - "EVP".ROWID[ROWID,10], "EVP"."ACHVTE"[VARCHAR2,1], "EVP"."TYPEVE"[VARCHAR2,3], "EVP"."NUMEVE"[NUMBER,22],                                                                                                                                          
           "EVP"."CODPRO"[VARCHAR2,16], "EVP"."CODSOC"[NUMBER,22]                                                                                                                                                                                             
      11 - "EVP".ROWID[ROWID,10], "EVP"."ACHVTE"[VARCHAR2,1], "EVP"."TYPEVE"[VARCHAR2,3], "EVP"."NUMEVE"[NUMBER,22],                                                                                                                                          
           "EVP"."CODPRO"[VARCHAR2,16], "EVP"."CODSOC"[NUMBER,22]                                                                                                                                                                                             
      12 - "EVP".ROWID[ROWID,10], "EVP"."CODSOC"[NUMBER,22], "EVP"."ACHVTE"[VARCHAR2,1], "EVP"."TYPEVE"[VARCHAR2,3], "EVP"."CODPRO"[VARCHAR2,16]                                                                                                              
      13 - "EVE".ROWID[ROWID,10], "EVE"."ACHVTE"[VARCHAR2,1], "EVE"."TYPEVE"[VARCHAR2,3], "EVE"."NUMEVE"[NUMBER,22], "EVE"."DATEVE"[VARCHAR2,8],                                                                                                              
           "EVE"."CODSOC"[NUMBER,22]                                                                                                                                                                                                                          
      14 - "EVE".ROWID[ROWID,10], "EVE"."ACHVTE"[VARCHAR2,1], "EVE"."TYPEVE"[VARCHAR2,3], "EVE"."NUMEVE"[NUMBER,22], "EVE"."DATEVE"[VARCHAR2,8],                                                                                                              
           "EVE"."CODSOC"[NUMBER,22]                                                                                                                                                                                                                          
      15 - "EVE".ROWID[ROWID,10], "EVE"."ACHVTE"[VARCHAR2,1], "EVE"."TYPEVE"[VARCHAR2,3], "EVE"."NUMEVE"[NUMBER,22], "EVE"."DATEVE"[VARCHAR2,8],                                                                                                              
           "EVE"."CODSOC"[NUMBER,22]                                                                                                                                                                                                                          
      16 - "EVE".ROWID[ROWID,10], "EVE"."ACHVTE"[VARCHAR2,1], "EVE"."TYPEVE"[VARCHAR2,3], "EVE"."NUMEVE"[NUMBER,22], "EVE"."DATEVE"[VARCHAR2,8],                                                                                                              
           "EVE"."CODSOC"[NUMBER,22]                                                                                                                                                                                                                          
      17 - "EVE".ROWID[ROWID,10], "EVE"."CODSOC"[NUMBER,22], "EVE"."ACHVTE"[VARCHAR2,1], "EVE"."TYPEVE"[VARCHAR2,3], "EVE"."DATEVE"[VARCHAR2,8]                                                                                                               
    Oracle version is:
     Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit 
    ...
    And my Optimizer Parms are:

    SQL > show parameter optimizer
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      10.2.0.3
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      FIRST_ROWS_100
    optimizer_secure_view_merging        boolean     TRUE
    SQL>
    SQL> show parameter cursor_sharing
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    cursor_sharing                       string      EXACT
    SQL> column sname format a20
    SQL> column pname format a20
    SQL> column pval2 format a20
    SQL>     select
      2  sname,pname,pval1,pval2
      3  from sys.aux_stats$;
    
    SNAME                PNAME                     PVAL1 PVAL2
    -------------------- -------------------- ---------- --------------------
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          01-14-2010 21:05
    SYSSTATS_INFO        DSTOP                           01-14-2010 21:05
    SYSSTATS_INFO        FLAGS                         1
    SYSSTATS_MAIN        CPUSPEEDNW             1247,559
    SYSSTATS_MAIN        IOSEEKTIM                 5,053
    SYSSTATS_MAIN        IOTFRSPEED            45469,627
    SYSSTATS_MAIN        SREADTIM                  2,583
    SYSSTATS_MAIN        MREADTIM                  1,851
    SYSSTATS_MAIN        CPUSPEED                   1329
    SYSSTATS_MAIN        MBRC                         14
    
    SNAME                PNAME                     PVAL1 PVAL2
    -------------------- -------------------- ---------- --------------------
    SYSSTATS_MAIN        MAXTHR                174532608
    SYSSTATS_MAIN        SLAVETHR                  48128
    If you think I missed something important in this post sample made me know, please.

    Kind regards
    Marek

    To update all the records in the table to 700K, one of the fastest ways would be to recreate a new table:
    CREATE TABLE PSI_NEW AS SELECT psi.*, min (eve.dateve)
    FROM Eve, lb/po2, evp
    where
    Eve.codsoc = evp.codsoc and eve.achvte = evp.achvte and eve.typeve = evp.typeve and eve.numeve = evp.numeve
    and eve.codsoc = psi.num_mag and eve.achvte = 'V' and eve.typeve in('TIC','FAV')
    and eve.dateve ' 20090101 ', ' 20091231' and evp.codpro = psi.ref_pro

    Another technique that can work well is using the merge command:
    MERGE INTO PSI has (select min (eve.dateve) as min_dat, evp.codpro as codpro help
    Since the day before, evp
    where eve.codsoc = evp.codsoc and eve.achvte = evp.achvte and eve.typeve = evp.typeve and eve.numeve = evp.numeve
    and eve.codsoc = psi.num_mag and eve.achvte = 'V' and eve.typeve in('TIC','FAV')
    and eve.dateve between '20090101' and '20091231'
    GROUP BY evp.codpro) b ON (a.ref_pro = b.codpro)
    WHEN MATCHED, THEN update SET PREMIERE_VENTE = B.min_dat

    The advantage of the two modes is that you don't have any subquery launched K 700 times.

    Published by: B.Guillaumin on January 15, 2010 18:00

    Published by: B.Guillaumin on January 15, 2010 18:27

  • SQL - update with joins

    My database contains several tables in a parent-child relationship (5 levels). Tables for children contain unique (foreign key) of the parents. I need to update a field in the table below level with a hardcoded value (for example: the value d.field3 = 103), but only on the rows that match certain general criteria. Criteria are set at different levels of the hierarchy. I tried several approaches, but in the end, I still get the same error:

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

    So far, I tried the following:
    -create a view based on all joins (where b.fk = a.id etc.) and then write my update with the "filtering" query where clauses (for example: where b.field1 = 'abc' and c.field2 = 123... etc)
    -create a query of update (without creating a preliminary view) which contains in the 'where' clause all joins and clauses of filtering

    I am trying to adapt some scripts from SQL Server to Oracle, but nothing seems to work for this one. Your help is greatly appreciated.

    Thank you
    Alberto

    Something like:

    update CM_CRITERION_LINE_MASTER set function_id = 103
    where criterion_master_id in (
      SELECT CM_CRITERION_MASTER.criterion_master_id
      from CM_CRITERION_MASTER, CM_STATEMENT, CM_CRITERION, CM_RULE, CM_CASE
      where CM_CRITERION_MASTER.criterion_master_id = CM_CRITERION.criterion_master_id
        and CM_CRITERION.statement_id = CM_STATEMENT.statement_id
        and CM_STATEMENT.rule_id = CM_RULE.rule_id
        and CM_RULE.case_id=CM_CASE.case_id
        and CM_CASE.case_category_id=2
        and CM_CASE.case_id > 799999
        and CM_RULE.rule_category_id 9
        and CM_RULE.task_id in (102,108,112,113,114,123,116)
    )
      and CM_CRITERION_LINE_MASTER.function_id=11
    

    Of course, you need to test.

    Time to understand that SQL Server and Oracle, as well as other DBMS each differ :)

    Gints Plivna
    http://www.gplivna.EU

  • When I add a playlist to my library, it automatically updated with new songs?

    Hello world

    When I add a playlist to my library, for example a list of music playback from Apple which is regularly updated by the editors ("Best of the Week" or 'Hits of today', for example), did the playlist in my library automatically update with new songs, when new songs are added?

    Thank you in advance.

    Hello, take a look at this article If you see not your entire library after you update iTunes on your Mac or PC - Apple Support

  • Restrictions does not not after ISO put 10.0.1 update with the new iPhone 7

    Restrictions does not after ISO put 10.0.1 update with the new iPhone 7 any which option of ranking app I don't choose no changes are made.  All the patches?

    Thank you

    Hello Launcher,

    Thank you for bringing your question about Restrictions here in Apple Support communities. My understanding of your question is that you change the Restrictions, but no change is noticed. I tried the same on my iPhone 6 Plus running iOS 10 and noticed a similar situation. Please allow me the opportunity to explain how the Restrictions is designed to work. First, I put my limitations for applications, do not allow Apps and together 4 +, which basically means everything beyond 4 + will be blocked from buying. Then I went to the App Store and the first app that caught my attention was NCIS: hidden crimes. This app is rated 12 + and is definitely an application I would not want my toddler to help. It is that Restrictions come into play. When I type on NCIS: hidden Crimes, the Get option is grayed out. Restrictions does remove all apps, songs, books, etc. from view, but it will prevent the purchase, download, and install all applications rated above the setting you choose when you set up restrictions. It's the help article that discusses the Restrictions and prevent purchases: Use Restrictions in order to avoid buying on iPhone, iPad, or iPod touch.

    I checked on the restrictions help articles, and I understand where it can be a bit confusing. In the help article Use Restrictions on iPhone, iPad and iPod touch, it says "You can use Restrictions, also known as parental control, to block or limit specific applications and features on your iPhone, iPad or iPod touch." This means in fact that apps, features or services (rated above that helped you, or if you have turned off completely) can he no longer appears on the device if the restriction is activated and starts blocking them. I also tested this by activating Restrictions and turned the cursor for Safari to off. When I went back to the home screen, Safari doesn't show any more and I could no longer use it.

    I hope this helps to clarify how the Restrictions. If my understanding of the issue was not accurate to the issue that you are experiencing, I will be happy to pursue this issue with you. Please indicate exactly what you took measures, and what expectations you had or the some restrictions, applications, features, or services you are restricted. Thanks again and have a great rest of your day!

  • iPhoto did not update with 10.11

    the OS X 10.7 in 10.11, iPhoto is grayed out. When I was invited to be updated manually, I thought it was 'bought' under another ID. He was "bought" at the same time and installed at the factory.

    Mac OS X 10.10.3 and newer include Photos, which is designed as a replacement for iPhoto and can import library. If you want to go on the use of iPhoto in addition to or instead of switch to Photos, click here and try following the instructions; you will only be able to do if you have previously associated with iPhoto with the Mac App Store.

    iPhoto is not intended to and does not update with Mac OS X, even if it was originally shipped with the computer.

    (143201)

  • How can I update with a version without losing any data?

    I have a ZTE open regularly update with custom versions. Whenever I do this, I lose all my data on the phone, like contacts, applications installed in the store of market parameters (including wireless and send the parameters).

    All these data and recovery each time settings is extremely annoying. Is there a way to not lose in the process or to save them and repristining them later?

    Hi Enrico,.

    I know that for import/export of contacts, you can use the following commands:

    • to export contacts (excerpt):
    adb pull /data/local/indexedDB/chrome db
    

    This will store all the data of your device in a folder (in this case, called db) that is created when you opened your shell.

    • to restore (push) back of the unit:
    adb push db /data/local/indexedDB/chrome
    

    Following Github repository offers other tools and scripts for flashing, restore and backup of Gaia:

    I just tried to backup/restore a few times in the past, but it did not work as expected. Feel free to test them with caution. =)

    Thank you!!

    -Ralph

Maybe you are looking for

  • Satellite A100 - need Vista 64bits Mass Storage Controller & TOS1901 driver

    I have a notebook "Toshiba Satellite A100-049" who has the ability to support 4 GB memory (but which came with 2 GB) and I'm unable to find some drivers for it on the site Web of Tosiba. I put a second hard drive in the laptop (although far from my n

  • SL400 - low resolution with HDMI to the TV connection

    I'm trying to connect my laptop to my Toshiba HD ready TV (2743abg - exact model) SL400. I use a HDMI HDMI connection. I get very low resolution unbareable - 768 x 480. I looked at the Intel Driver software installed and it is the maximum resolution,

  • LabVIEW GOOP in 2013

    Hello I have a program that has been developed in LabVIEW 7 and uses the EIS to generate a report (modified data set, get the data to modify). I'm trying to put up-to-date LabVIEW 2013. I have the database connectivity kit and report generation tool.

  • problems installing Windows during the installation of adobe acrobat

    I tried to download Adobe Acrobat multiple times and it stops downloading saying that my "windows setup has a problem' and download needs to close?  Im not sure what is the windows installer.  Help, please!  I use vista 32 bit.

  • WRT610N - MAC filtering does not list the names of machine

    I replaced a DLink 624 with a Linksys WRT610N and am surprised to see that it doesn't seem to be a way to write the name of the machine with the MAC that I had with the Dlink router. Please tell me there is a way to do it.  There is no way I can foll