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!

Tags: BlackBerry Developers

Similar Questions

  • Commit to taking a lot of time for the update statement to bulk - 11 GR 2

    Hi team,

    We have a source table, which is the main table for our application.

    When I commit a transaction after update block, it takes long about 2 to 4 minutes.

    I don't understand why it takes too long...

    Could you please help me on this fix, please...

    It's the details on the table,

    Total number of records: 35 M record

    Validation interval: 500 records / commit

    Total scores: 3

    total number of columns: 95 - including primary, unique and foreign key columns (all columns will be updated for each update because update from the app online)

    Total no of the foreign key columns: 12

    Unique key column: 1

    Total index: 27 ( including the key index foreign 12 + 1 + 1 index of primary key Unique key index )

    example of update statement,

    UPDATE DIRECTORY_LISTING_STG
    SET
      COLUMN_1 = :VAL_1
      .
      .
      .
      COLUMN_94 = :VAL_94
    WHERE RECORD_KEY = :P_KEY_VAL;
    
    

    The table is.

    Plan hash value: 2997337465
    
    --------------------------------------------------------------------------------------------
    | Id  | Operation          | Name                  | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------
    |   0 | UPDATE STATEMENT   |                       |     1 |   308 |     3   (0)| 00:00:01 |
    |   1 |  UPDATE            | DIRECTORY_LISTING_STG |       |       |            |          |
    |*  2 |   INDEX UNIQUE SCAN| XPKDLS_STG_PARTPN     |     1 |   308 |     2   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("RECORD_KEY"=TO_NUMBER(:P_KEY))
    
    

    Details of the database,

    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    "CORE 11.1.0.7.0 Production"
    TNS for Linux: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    
    

    Thank you

    RAM

    2793617 wrote:

    Hello

    I am updating table via an application using Hibernate jdbc connection online.

    If the update statement will be sent to the database in a pack of 500 documents (batch update).

    Thanks Ram

    line-by-line UPDATE is slow by slow transformation

    In Oracle no other session can 'see' upgrade from uncommitted changes.

    The only way to significantly reduce the elapsed time is to have only 1 UPDATE & 1 COMMIT!

  • The single update statement to improve performance

    Hello

    I have a table as shown below and you have written plsql statement, as shown below.

    Collar collar collar collar collar E collar F D C B A

    NULL NULL NULL NULL 124 124

    NULL NULL NULL NULL 235 235

    NULL NULL NULL NULL 24556 24556

    NULL NULL NULL NULL 45645 45645

    NULL NULL NULL NULL 34255 34255

    If the Col is not null then

    Update tableA

    set Col = Col F A;

    Otherwise, if the Col B is not null then

    Update tableA

    game F Col = Col B;

    Otherwise, if E Col is not null then

    Update tableA

    game F Col = Col E;

    Otherwise, if the Col D is not null then

    Update tableA

    game F Col = Col D;

    Otherwise, if the Col C is not null then

    Update tableA

    game F Col = Col C;

    Can combine us these if statements in a unique single update statement.

    Thank you

    Khan

    Yes to COALESCE. If you could share create table statement with insert sample instructions will make it much easier for others to test and help you.

    for example

    update testcoal set colf = coalesce(cola,colb,cole,cold,colc)
    
  • 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 can be used depending on the result cache?

    Hi all

    I stumbled on an interesting question. UPDATE statement is used in the following function, even if the feature is created RESULT_CACHE. It seems illogical. I was wondering, is it possible?

    If so, why RESULT_CACHE is used?  Because it means "do not execute the function, look for the result of the hash table and return the results to the user ' if the UPDATE statement, so doesn't mean it should run for each call and use with RESULT_CACHE and UPDATE/DELETE/MERGE is illogical or wrong?

    Thanks for your help.

    FUNCTION to CREATE or REPLACE plch_get_data (FULL id_in)

    RETURN VARCHAR2

    RESULT_CACHE

    IS

    BEGIN

    Dbms_output.put_line ('run');

    UPDATE plch_data

    SET nm = UPPER (nm)

    WHERE id = id_in;

    COMMIT;

    RETURN "SUPERIOR."

    END;

    /

    Yes, it's the challenge of PL/SQL quiz - and the point of the quiz is only automatic relies on parsing by Oracle only supports arrays of account that is QUESTIONED.

    The tables that are affected by DML not a query as an update do not figure in automatic invalidation of a cache.

    I was hoping that the explanations given in the questionnaire itself would not lead to a thread - rather it would provide a pleasant and clear answer. So feel free to let me know if you think otherwise.

    As to why Oracle would let you include DML not a query inside a function of caching of result, well... I can easily accept that you shouldn't do this - in general. But I don't see that we should make it impossible. It would probably be a good candidate for an another PLW (PL/SQL warning), as in:

    "Non-requetes DML in a result caching function will not affect caching and can result in unexpected results."

  • 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.

  • Helps when a special character and is included in the update statement

    Hi gurus,


    Please suggest me here. Your help is greatly appreciated.

    Am wririting an update statement on a column called Phone_num.description varchar2 (40).


    Here is my update statement:


    UPDATE Phone_num
    DESCRIPTION SET = "Beta - EMV / not for the purpose of Production."
    WHERE DIAL_NUMBER = 18662307528
    AND DESCRIPTION =' to & VERIZON';


    Here is the structure of the table:

    Phone_num. Description varchar2 (40)
    Phone_num. DIAL_NUMBER Number (11)

    Sample data:


    So when I run the sql script it pop-up is to highlight.

    Please suggest how I can handle this.

    Hello

    As John said, the easiest thing is just to disable the functionality of substitution of variables, saying:

    SET DEFINE OFF

    before the statement.  If you need to re - enable this feature, then tell

    ALL SET ON

    just after the statement.

    If you can't do that, then break the literal string in 2 parts immediately after the & character, like this:

    UPDATE Phone_num

    DESCRIPTION SET = "Beta - EMV / not for the purpose of Production."

    WHERE DIAL_NUMBER = 18662307528

    AND DESCRIPTION = ' to &'. | "VERIZON";

    You can't have a substitution variable whose name starts by ', then SQL ("more does not interpret &" as meaning a substituton variable.)

  • 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<>

  • 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!

  • 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

  • Cancellation-TBS and very large update statements

    Hello

    to be sure that I'm right...

    Currently, it need to update a table with 230.000.000 lines. A single statement attempted to update 14.000.000 lines, but this update statement failed after 29 hours with ORA-015555.

    1 how long Undo-TBS store blocks? Only until the validation of the actual transaction, isn't?

    2. on the table, we have 7 index on columns. Is it true, that we can reduce the amount of Undo-SCT for this operation if we remove some clues?

    Kind regards

    Mark

    Ask DBA_SEGMENTS or DBA_ROLLBACK_SEGMENTS for segments Undo and V$ UNDOSTAT for usage of Cancel.

    Hemant K Collette

  • What update statement is sent to the database?

    In several pages, I use the Apex line (DML) 4.2 automatic treatment processes. If I do an update of a record, which are columns in the update statement? All columns, only the displayed, only the columns changed, also the PK column?

    As far as I can see now all the columns that are displayed are updated, also the PK, which is display only.

    I ask this, because when the PK is updated (not changed is screen only) all tables in my 75 cases, where this PK is used as FK, will get a lock.

    I did some tests and find out that indeed the Apex is updating all the columns used in the elements by Type of Source is the database column. Even if this item is display only, read-only, etc.!

    My solution now, to prevent the locks, is the following:

    Automated line Fetch:

    Primary key column value containing point: Pxx_ID

    ID of the primary key column: (this is the primary key)

    Pxx_ID (display only, hidden or read-only)

    Source: only when the current value in session state is set to zero

    Source type: static assignment<-->

    Source of value or expression:

    Treatment of automatic line (DML)

    Primary key column value containing point: Pxx_ID

    Primary key column: ID

  • line blocking during the update statement


    Hello

    Using Oracle 11 g 2. If I call the following update statement of meeting A, meeting A locks the line until a statement commit / rollback is emanating from the session has. If the session B calls the same statement was updated and the same line, session B will have to wait until the lock is released in the session. However, application developers are expressed in terms of discussions. Would it be possible that the update statement is called in the same session by several requests? If so, the case statement can be evaluated without the line being locked which could lead to erroneous results? Trying to keep this short message.

    tableA has column (number of key, primary) and columnB (number)

    {

    Update tableA

    Define columnB = case when columnB = 3 then

    4

    When columnB = 4 then

    5

    on the other

    columnB

    end

    When columnA = 6;

    }

    2 applications (almost at the same time) in the same session could assess columnB 3. The goal would be the first query sets in column 4 and the second request sets in column 5.

    > However, application developers are expressed in terms of discussions.

    Of course, they are...

    But each application thread will have its own dedicated database session.

  • GoldenGate reproducing not UPDATE statement

    Hi all

    I have this problem with my process of goldengate. I created processes extract and replicat process, I was loading initial thru expdp and impdp. All right (insert, delete) until execution of the update statement. He added my replicat process.

    Here is the error:

    2013-07-22 17:05:16 WARNING OGG-01431 abandoned grouped transaction on "OWNER. Table_name', mapping error.

    2013-07-22 17:05:16 WARNING OGG-01003 repositioning of rba in seqno 162688 0.

    2013-07-22 17:05:16 WARNING mapping OGG-01151 error to the OWNER. Table_name to the OWNER. TABLE_NAME.

    2013-07-22 17:05:16 WARNING OGG-01003 repositioning of rba in seqno 162688 0.

    The table does not have the keys to the identifier.

    How should I solve my problem?

    Thank you very much in advance for gurus.

    When you get a mapping error, there will be more details on the issue in the discard file. Take a look here for the error.

    But in general, updates, you must make sure that you did a TRANDATA ADD on the side of the source in order to have the columns, you must apply the operation target and on target, if you do not have a PK or the user interface, you must specify KEYCOLS in the card then Replicat knows which columns to use to format the WHERE clause.

    Let us know what error is in your file throw, and we can go from there.

    Best regards

    Mary

Maybe you are looking for

  • How can I keep my macbook pro closed with logic?

    I have a Macbook Pro 2015 retina and a bolt of lightning 27 screen. I use Logic Pro X How can I keep the Macbook Pro closed on a stand?   without opening it to activate the market every time I use it? I've seen many people do. And it will do no harm

  • Lopez Burk field (Double reciprocal plot)

    Hi all I'm doing a double reciprocal plot of my data of the enzyme. I don't know how to go from a basic scatter chart plot to a double reciprocal plot. I got my macbook in 2014 and the software is: OS X 10.9.5 (13F1603) Thank you much in advance. Kin

  • ReadyNAS OS 6.4.0 - T136 (beta 4) Bug - RN314

    Just updated to the latest beta build 4 and the ReadyDLNA is still broken. Abandoned by ReadyCLOUD, may not have to work since the PC application but has failed to operate the link test2 Netgear, pc soft does not accept my user name or password and w

  • Cannot print in landscape of laserjet p1505n

    I have 2 p1505n, each on kubuntu 12.10 and hplip 3.12.6, a home, at the office.  The one at home works fine, but it has 20120201 firmware, while the Bureau has firmware 20080505 and does not print in landscape.  Otherwise everything is the same.  I t

  • Problems to install Windows 7 on Windows 8

    Original title: os I used windows 8 in my laptop. I tried to change to windows 7. during the installation of an operating system, there is a common error "windows could not update the computer startup configuration. I formatted the entire system, exc