Update of table with 14 million records

good day, I'm updating a table with 14 million documents column. using the data from another table.
This takes terrible time just updated to 500,000 over the weekend, which is unacceptable.
ideas to improve my code and get the fastest update is much appreciated.

DECLARE
TYPE vc_type is table of index varchar2 (20) by pls_integer;
type tabtype_rowid is table of pls_integer rowid indexes;
my_cur sys_refcursor;
cur_limit integer: = 10000;

tab_rowid tabtype_rowid;

Start
OPEN FOR My_cur
SELECT value, rowid
TABLE 1A

where the value IS NOT NULL
and id is null;


loop
collect the fetch my_cur in bulk in tab_value, cur_limit limit tab_rowid;

FORALL k IN 1.tab_npi.count

UPDATE table 1A
A.ID = (select id SET
in Table 2b
where value = tab_value (k)
and rownum = 1
)
WHERE a.rowid = tab_rowid (k);

COMMIT;

When the output tab_value.count < cur_limit;.
end loop;

END;


Thank you

903537 wrote:
I tried to update basic training, as a first step and it crashed...

He didn't fail, it failed.

Tags: Database

Similar Questions

  • Best way to update a table with separate values

    Hi, I would really appreciate some advise:

    I need to regularly perform a task where I update 1 table with all the new data that has been entered in another table. I cannot perform a complete insert because this will create data duplicated each time it works, so the only way I can think of is the use of cursors in the script below:


    CREATE OR REPLACE PROCEDURE update_new_mem IS
    tmpVar NUMBER;

    CURSOR c_mem IS
    SELECT nom_membre, member_id
    OF gym.members;
    CREC c_mem % ROWTYPE;


    BEGIN
    OPEN c_mem.
    LOOP
    SEEK c_mem INTO crec;
    EXIT WHEN c_mem % NOTFOUND;
    BEGIN
    UPDATE gym.lifts
    Name = crec.member_name
    WHERE member_id = crec.member_id;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
    END;
    IF SQL % NOTFOUND THEN
    BEGIN
    INSERT INTO gym.lifts
    (name, member_id)
    VALUES (crec.member_name, crec.member_id);
    END;
    END IF;
    END LOOP;
    CLOSE C_mem;

    END update_new_mem;



    This method works, but y at - it a (faster) easier way to update another table with new data only?

    Thank you very much

    >
    This method works, but y at - it a (faster) easier way to update another table with new data only?
    >
    Almost anything would be better than this treatment of slow-by-slow loop.

    You don't need a procedure, you should just use MERGE for this. See the examples in the section of the MERGER of the doc of the SQL language
    http://docs.Oracle.com/CD/B28359_01/server.111/b28286/statements_9016.htm

    MERGE INTO bonuses D
       USING (SELECT employee_id, salary, department_id FROM employees
       WHERE department_id = 80) S
       ON (D.employee_id = S.employee_id)
       WHEN MATCHED THEN UPDATE SET D.bonus = D.bonus + S.salary*.01
         DELETE WHERE (S.salary > 8000)
       WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
         VALUES (S.employee_id, S.salary*.01)
         WHERE (S.salary <= 8000);
    
  • Update of table with invalid identifiers

    Hello!

    I use a third-party plug-in and that comparisons of chemical structures. I want to update a table with the values of the other when the plugin matches two rows. However, I'm a problem invalid identifier.

    Two tables:
    PLATES: a VARCHAR2 columns of PLATE_SMILES, IN_DB
    INVEST: a VARCHAR2 columns of SMILES

    The operator is a binary: jc_compare (PLATE_SMILES, SMILES) = 1 (or 0 if they do not match)

    I want my query to say: "If comparison SMILES, PLATE_SMILES = 1, define IN_DB = 1 for row" - effectively asking if PLATE_SMILES exists in the table INVEST.

    I tried a number of "renditions", all identifiers not valid donations. Here is an example:

    Update (select plate. PLATE_SMILES, plate. IN_DB, invest. SMILES
    plate PLATES
    INVEST invest
    WHERE jc_compare (PLATE_SMILES, SMILES) = 1)
    set plate. IN_DB = 1;


    ORA-00904: "FLAT". "" IN_DB ": invalid identifier


    I hope that this should be an easy fix, and any help is greatly appreciated!

    Hello

    You have

    UPDATE (SELECT plate.plate_smiles,
                   plate.in_db,
                   invest.smiles
            FROM   plates plate, invest invest
            WHERE  jc_compare ( plate_smiles, smiles) = 1)
    SET    plate.in_db = 1;   -- Error here
    

    PLATE is not known outside the display online. Just remove it.

    Concerning
    Peter

  • update of table with similar registration information using the same key

    Version: 11.1.0.7.0

    We have large table probably 30 M records

    -test code table follows

    create table people)

    person_id number,

    first name varchar2 (50).

    middle_name varchar2 (50).

    last_name varchar2 (50)

    );

    insert into persons (person_id, first_name, last_name, middle_name) values (1, 'JOHN', 'A', 'DOE');

    insert into people (person_id, first_name, last_name, middle_name) values (1, 'JOHN', ","DOE");

    insert into persons (person_id, first_name, last_name, middle_name) values (1, 'JOHN', 'ADAM', 'DOE');

    insert into persons (person_id, first_name, last_name, middle_name) values (2, 'JOHN', ' C ', 'DOE');

    insert into people (person_id, first_name, last_name, middle_name) values (2, 'JOHN', ","DOE");

    insert into people (person_id, first_name, last_name, middle_name) values (3, 'JOHN', ","MOE");

    insert into persons (person_id, first_name, last_name, middle_name) values (3, 'JOHN', 'FRANK', 'MOE');

    I am trying to write more efficient code to take the middle name of the most complete and updated all records with the same KEY (person_id) with her.

    Expected result:

    1, JOHN, ADAM, DOE

    1, JOHN, ADAM, DOE

    1, JOHN, ADAM, DOE

    2, JOHN, C., DOE

    2, JOHN, C., DOE

    3, JOHN, FRANK, MOE

    3, JOHN, FRANK, MOE

    Hello

    Here is an example of the use of the aggregate LAST instead of the function ROW_NUMBER analytic function:

    MERGE INTO dst people

    WITH THE HELP OF)

    WITH got_longest_middle_name AS

    (

    SELECT person_id

    , MIN (middle_name) DUNGEON (DENSE_RANK LAST ORDER OF LENGTH (REPLACE (middle_name, '.')))

    AS longest_middle_name

    AMONG the people

    WHERE middle_name IS NOT NULL

    GROUP BY person_id

    )

    SELECT person_id

    longest_middle_name

    Got_longest_middle_name c - c is for candidates

    WHERE DOES NOT EXIST)

    SELECT 1

    AMONG the people

    WHERE person_id = c.person_id

    AND c.longest_middle_name NOT AS REPLACE (middle_name, '.'). '%'

    )

    )             src

    WE (dst.person_id = src.person_id)

    WHEN MATCHED THEN UPDATE

    SET dst.middle_name = src.longest_middle_name

    WHERE dst.middle_name <> src.longest_middle_name

    OR dst.middle_name IS NULL

    ;

    I suspect that this may be a little faster, but try it on your system with your data to make sure.

  • How to update the table with the number management

    Hello

    I need as there is a loc_tab of the created table as below,

    CREATE TABLE loc_tab
    (
    Country_ID NUMBER,
    country_code VARCHAR2 (3),
    country_name VARCHAR2 (50).
    State_ID NUMBER,
    state_code VARCHAR2 (3),
    state_name VARCHAR2 (50).
    city_id NUMBER,
    city_code VARCHAR2 (3),
    city_name VARCHAR2 (50)
    );

    I inserted records like below,
    COUNTRY_ID     COUNTRY_CODE     COUNTRY_NAME     STATE_ID     STATE_CODE     STATE_NAME     CITY_ID     CITY_CODE     CITY_NAME
    
              IND          INDIA                    TN          TAMIL NADU          CHN          CHENNAI
              IND          INDIA                    TN          TAMIL NADU          TRI          TRICHY
              IND          INDIA                    TN          TAMIL NADU          CMT          COIMBATORE
              IND          INDIA                    TN          TAMIL NADU          MDU          MADURAI
              IND          INDIA                    AP          ANDHRA PRADESH          HYD          HYDERABAD
              IND          INDIA                    AP          ANDHRA PRADESH          SEC          SECUNDRABAD
              AUS          AUSTRALIA               QLD          QUEENSLAND          BRI          BRISBANE
              AUS          AUSTRALIA               TAS          TASMANIA          HB          HOBART
              AUS          AUSTRALIA               TAS          TASMANIA          CCE          CITY OF CLEARANCE
              AUS          AUSTRALIA               TAS          TASMANIA          BUR          BURNIE
    Now, I wanted to update the table such that all ID columns are updated with running number.

    Each ID columns should get incremented so that, for Country_ID column corresponding to "India" If country_id is 1, that there must be one for all the lines with the name as "India". Likewise for "Australia".

    In the case of State, she also has the same logic with numbers repeated until the very name of the State comes.

    For the city, it of course will hold separate ID only because the name of the city will not get duplicated.

    This update must be done in the normal way using simple SQL such as no PLSQL don't like looping, etc... is involved.

    Here are the contents of the table, and that's how the table should be updated,
    COUNTRY_ID     COUNTRY_CODE     COUNTRY_NAME     STATE_ID     STATE_CODE     STATE_NAME     CITY_ID     CITY_CODE     CITY_NAME
                                            
    1          IND          INDIA          1          TN          TAMIL NADU     1     CHN          CHENNAI
    1          IND          INDIA          1          TN          TAMIL NADU     2     TRI          TRICHY
    1          IND          INDIA          1          TN          TAMIL NADU     3     CMT          COIMBATORE
    1          IND          INDIA          1          TN          TAMIL NADU     4     MDU          MADURAI
    1          IND          INDIA          2          AP          ANDHRA PRADESH     1     HYD          HYDERABAD
    1          IND          INDIA          2          AP          ANDHRA PRADESH     2     SEC          SECUNDRABAD
    2          AUS          AUSTRALIA     1          QLD          QUEENSLAND     1     BRI          BRISBANE
    2          AUS          AUSTRALIA     2          TAS          TASMANIA     1     HB          HOBART
    2          AUS          AUSTRALIA     2          TAS          TASMANIA     2     CCE          CITY OF CLEARANCE
    2          AUS          AUSTRALIA     2          TAS          TASMANIA     3     BUR          BURNIE
    Thank you and best regards,
    Shiva
  • Update a table that has 1291444946 records

    Hi friends,

    We have table with 1291444946 records in this 13844852 files are updated. The current time is 12:22:55.19.This simple update statement
    update table_name set a=b where a=c;
    Superior wait event was scattered db read file.
    DB_Version=11.2.0.2
    OS=Solaris 10 x86
    SGA=16GB
    PGA=6GB
    Cursor_sharing=EXACT
    Is their anyway, we can reduce this time to 6 hours or less.

    Concerning
    NM

    What is the status here?

    Can you update us if you please, or close the message if the problem has been resolved

  • Update a table with one column of another

    Oracle 11g
    Hello

    i'im trying to update the two columns of table SUPPORT (SUPPORT_X, SUPPORT_Y) with two columns of table POST_HTA_BT (POSTHTABT_GPS_X, POSTHTABT_GPS_Y)

    Understand that the two tables have the colum below:

    SUPPORT (SUPPORT_ID, SUPPORT_PLAQUE, POSTHTABT_ID, SUPPORT_X, SUPPORT_Y,...)

    POST_HTA_BT (POSTHTABT_ID, POSTHTABT_GPS_X, POSTHTABT_GPS_Y,...)

    The SUPPORT_PLAQUE has type varachar. Except the keys, the other columns are varchar type in both tables.

    The point here is to update the support_x, support_y with posthtabt_gps_x and posthtabt_gps_y.But before the update we have Sheik if the fifth number of the support plate is a number of characters from "0" to "9"and the rest of the caracter of the support_plaque is '00000'

    Please note that the support_plaque is stored in the table with the form: "0025800000!"

    So I did the below script, I try to execute in sql develop.

    SET SERVEROUTPUT ON

    DECLARE
    chiffre_liste varchar (200): = '0 ', '1', '2', '3', '4', ' 5 ', ' 6' ', 7', ' 8 ', ' 9';
    CURSOR CUR_GPS_SUPPORT IS
    Select MEDIA. SUPPORT_X, SUPPORT. SUPPORT_Y, POSTE_HTA_BT. POSTHTABT_ID, SUPPORT. EXPL_ID,
    SUPPORTED. SUPPORT_PLAQUE, POSTHTABT_GPS_X, POSTHTABT_GPS_Y
    support,.
    POSTE_HTA_BT
    where
    SUPPORTED. SUPPORT_X IS NULL and
    SUPPORTED. SUPPORT_Y IS NULL and
    SUPPORTED. POSTHTABT_ID = POSTE_HTA_BT. POSTHTABT_ID and
    SUPPORTED. EXPL_ID = POSTE_HTA_BT. EXPL_ID
    Order of SUPPORT. POSTHTABT_ID;

    w_POSTHTABT_ID POSTE_HTA_BT. Type of POSTHTABT_ID %;
    w_SUPPORT_X SUPPORT. TYPE % SUPPORT_X;
    w_SUPPORT_Y SUPPORT. TYPE % SUPPORT_Y;
    w_EXPL_ID SUPPORT. TYPE % EXPL_ID;
    w_SUPPORT_PLAQUE SUPPORT. TYPE % SUPPORT_PLAQUE;
    w_POSTHTABT_GPS_X POSTE_HTA_BT. TYPE % POSTHTABT_GPS_X;
    w_POSTHTABT_GPS_Y POSTE_HTA_BT. TYPE % POSTHTABT_GPS_Y;

    BEGIN
    DBMS_OUTPUT. Put_line ('loading the coordoonnees GPS - GPS Coord update takes care of starting ');

    FOR HEART LOOPING CUR_GPS_SUPPORT

    w_POSTHTABT_ID: = cur. POSTHTABT_ID;
    w_SUPPORT_PLAQUE: = cur. SUPPORT_PLAQUE;
    w_SUPPORT_X: = cur. SUPPORT_X;
    w_SUPPORT_Y: = cur. SUPPORT_Y;
    w_POSTHTABT_GPS_X: = cur. POSTHTABT_GPS_X;
    w_POSTHTABT_GPS_Y: = cur. POSTHTABT_GPS_X;

    If substr (cur.support_plaque, 5, 1 chiffre_liste) and substr (cur.support_plaque, 6, 5) = '00000'
    w_SUPPORT_X: = CUR. POSTHTABT_GPS_X
    w_SUPPORT_Y: = CUR. POSTHTABT_GPS_Y
    END if;
    EXCEPTION WHEN NO_DATA_FOUND THEN w_SUPPORT_X: = NULL and w_SUPPORT_Y: = NULL;
    END;

    -Updated the table of the supports
    Update SUPPORT
    Set SUPPORT_X = w_SUPPORT_X,
    SUPPORT_Y = w_SUPPORT_Y
    where SUPPORT_PLAQUE = w_SUPPORT_PLAQUE;
    -On valid imm? immediately
    commit;
    EXCEPTION when no_data_found then null;
    -No details found
    END;

    END;
    /

    and I got the following errors:

    Error report:
    ORA-06550: line 2, colum 34:
    PLS-00103: symbol ',' met instead of one of the following symbols:

    * & = - + ; <>/ is mod remains not rem
    <>< Hurst (*) > or! = or ~ = > = < = <>and like2 or
    like4 likec between | submultiset of type multiset Member
    ORA-06550: line 2, column 52:
    PLS-00103: symbol ';' met instead of one of the following symbols:

    ), * & = - + <>/ is mod remains not rem = >
    <>< Hurst (*) > or! = or ~ = > = < = <>and like2 or
    like4 likec between | Member of multiset must
    ORA-06550: line 38, colum 48:
    PLS-00103: symbol 'CHIFFRE_LISTE' met instead of one of the following symbols:

    (
    Symbol "(" a été substitué à "CHIFFRE_LISTE" verser continuer.) "
    ORA-06550: line 39, 12 colum:
    PLS-00103: symbol 'W_SUPPORT_X' met instead of one of the following symbols:

    ), * & -+ / at rem mod < Hurst (*) > rest and or.
    multiset
    ORA-06550: line 40, 12 colum:
    PLS-00103: symbol 'W_SUPPORT_Y' met instead of one of the following symbols:

    . (), * @ % & = - + <>/ is mod remains not rem
    <>< Hurst (*) > or! = or ~ = > = < = <>and like2 or
    like4 likec between | mult
    ORA-06550: line 41, colum 9:
    PLS-00103: symbol 'END' met instead of one of the following symbols:

    . (), * @ % & = - + <>/ is mod remains not rem
    <>< Hurst (*) > or! = or ~ = > = < = <>and like2 or
    like4 likec between | multiset members
    06550 00000 - "line %s, column % s:\n%s".
    * Cause: Usually a PL/SQL compilation error.
    * Action:

    I checked the line number, but do not see the error in my code.

    Please could you help me?

    peace

    Hello

    glad to know that it worked. In fact, I don't see the reason to make these complicated processes.

    Remember the mantra:

    • If you can do it with SQL then do it with SQL

    Good evening!

    Alberto

  • update a table with sequence colmn

       how to update a colmn of table with sequence 
    
       e.x 
       
    COLMN1     COLMN2
    A     
    D     
    RTR     
    XX
    G     
    
    how to update colm2 like 
    
    COLMN1     COLMN2
    A               1
    D               2
    RTR               3
    XX              4
    G               5
    update tab set col2 = rownum;
    commit;
    
  • Update the Table with the push button

    Hi I want to update my table using the push button that requires a transfer of account

    For example a single account transactions into 2nd account


    I used this query, but his does not work

    Update of cb
    Set cb_acc_id =: block3.acc_id_target
    where
    cb_acc_id =: block3.acc_id_source;



    Concerning

    Wasim Ismail

    You may forgot to validate your update...

    BTW:
    your form will not recognize, you start a transaction and make an update in the database.

  • Update a table with primary key

    Hello

    I have a table called Temp

    CREATE TABLE TEMP
    (
       A   VARCHAR2 (50 CHAR),
       B   VARCHAR2 (50 CHAR),
       C   VARCHAR2 (50 CHAR),
       D   VARCHAR2 (18 CHAR),
       E   DATE,
       F   NUMBER,
       G   VARCHAR2 (18 CHAR),
       H   FLOAT
    );
    

    The primary key is the PRIMARY KEY: (A, B, C, D, E, F, G).

    I HAVE THE TEMPORARY TABLE 48052365 COUNTY,

    HOWEVER I HAVE A REQUIREMENT TO UPDATE WHERE E (COLUMN) IS WEDNESDAY, THE SAME DAY IN MONDAY (I.E., C - 2 TO EXISTING DATE)

    Approach;

    I CREATED the TABLE TEMP_WED_TO_MONDAY AND SELECTED ALL THE RECORDINGS ELIGIBLE IN CE AND TABLE AND INDEX UNIQUE CREATED on this SUBJECT. TO UPDATE, I WROTE UNDER ANONYMOUS BLOCK.

    Number of Tables: TEMP_WED_TO_MONDAY is 46,921,912 and count of total of the table is 48052365

    Anonymous block:

    DECLARE
       CURSOR UPDATE_TEMP_DATE
       IS
          SELECT A,
                 B,
                 C,
                 D,
                 E,
                 F,
                 G,
                 E - 2 NEW_E
            FROM TEMP_WED_TO_MOONDAY;
    
    
       TYPE UPDATE_TEMP_DATE_REC IS RECORD
       (
          A       VARCHAR2 (50 CHAR),
          B       VARCHAR2 (50 CHAR),
          C       VARCHAR2 (50 CHAR),
          D       VARCHAR2 (18 CHAR),
          E       DATE,
          F       NUMBER,
          G       VARCHAR2 (50 CHAR),
          NEW_E   DATE
       );
    
    
       TYPE UPDATE_TEMP_DATE_TBL_TYPE IS TABLE OF UPDATE_TEMP_DATE_REC;
    
    
       UPDATE_TEMP_DATE_TBL   UPDATE_TEMP_DATE_TBL_TYPE;
    BEGIN
       OPEN UPDATE_TEMP_DATE;
    
    
       LOOP
          FETCH UPDATE_TEMP_DATE
             BULK COLLECT INTO UPDATE_TEMP_DATE_TBL
             LIMIT 1000000;
    
    
          EXIT WHEN UPDATE_TEMP_DATE_TBL.COUNT = 0;
    
    
          FORALL I IN UPDATE_TEMP_DATE_TBL.FIRST .. UPDATE_TEMP_DATE_TBL.LAST
             UPDATE TEMP
                SET E = UPDATE_TEMP_DATE_TBL (I).NEW_E
              WHERE     A = UPDATE_TEMP_DATE_TBL (I).A
                    AND B = UPDATE_TEMP_DATE_TBL (I).B
                    AND C = UPDATE_TEMP_DATE_TBL (I).C
                    AND D = UPDATE_TEMP_DATE_TBL (I).D
                    AND E = UPDATE_TEMP_DATE_TBL (I).E
                    AND F = UPDATE_TEMP_DATE_TBL (I).F
                    AND G = UPDATE_TEMP_DATE_TBL (I).G;
    
    
          COMMIT;
       END LOOP;
    
    
       CLOSE UPDATE_TEMP_DATE;
    END;
    
    

    But for the past 6 hours, it only updated records 20,00,000(Twenty lakh) only. because this update in the table and is also part of the teaching primary key I think it takes time, but pointers to improve/acceleration of the update

    Explain the plan:

    update statement all_rows (Cost 4)
      3 update hr.temp 
        2   table access by index rowid table hr.temp (Cost 4, Bytes : 64 ,Cardinality 1)
          1    index range scan index hr.temp_wed_to_monday (Cost 3: Cardinality 1)
    

    Thank you guys, I would be grateful if someone provides the solution for the scenario, rather than highlight the design. Please understand someone designed to best with whatever the limits it has during this period. (and this isn't me).

  • Script table with Clob and record another database

    Hello

    How can I read the Clob column data and insert into another table in the database.

    The first Table is quality Test and second Production

    Is there a way without using Export / Import?

    What can I use the charger?



    With the help of 9i

    muttleychess wrote:

    mschnatt wrote:
    You can only try the db-link

    CREATE LINK of the DATABASE to CONNECT to IDENTIFIED BY with the HELP of "";

    and make the table

    create table...
    in select...

    Thank you, but too no work :-(:-(

    SQL> select id,clob_data from myclob@teste;
    select id,clob_data from myclob@teste
    *
    ERRO na linha 1:
    ORA-22992: cannot use LOB locators selected from remote tables
    

    Well you don't have the answer said to

    and make the table

    create table...
    in select...

    Also in the manual, you could save a lot of time if you open.

    http://docs.Oracle.com/CD/B14117_01/AppDev.101/b10796/adlob_wo.htm#1006314

    >
    The following syntax is supported on the remote LOB columns:

    CREATE TABLE t AS SELECT * FROM table1@remote_site;
    INSERT INTO t SELECT * FROM table1@remote_site;
    UPDATE t SET lobcol = (SELECT lobcol FROM table1@remote_site);
    INSERT INTO table1@remote_site select * from local_table;
    UPDATE table1@remote_siteset lobcol = (SELECT lobcol FROM local_table);
    DELETE FROM table1@remote_site 
    

    It is the only syntax support involving some LOBs in remote tables. No other use is supported.

  • SQL Query to retrieve records in a table with the same records or only one record in a table

    Hello

    Got a curious requirment to extract the Non-distincts records in a table

    Example of

    Account number Type of account
    12345SB
    12345

    SB

    12346CR
    12346SB
    12347SB
    12348CR
    12349SB

    Requrirement is to retrieve the records as follows

    Result must be

    Account number Type of account
    12345SB
    12345

    SB

    12347SB
    12348CR
    12349SB

    You will notice that 12346 which has two separate lines have been eliminated in the result. I tried several qeries to achieve this result, one or the other had a few mismatch. Can someone give me a request for it.

    Thanks in advance.

    SELECT ACCOUNT_NUMBER,

    ACCOUNT_TYPE

    DE)

    SELECT ACCOUNT_NUMBER,

    ACCOUNT_TYPE,

    COUNT (*) ON CNT_ACC (ACCOUNT_NUMBER PARTITION).

    COUNT (*) ON CNT_NUM_TYP (PARTITION ACCOUNT_NUMBER, ACCOUNT_TYPE)

    FROM T1)

    WHERE CNT_ACC = CNT_NUM_TYP;

    exit;

    12345 SB
    12345 SB
    12347 SB
    12348 CR
    12349 SB
  • Update a table with a query that uses the table updated

    Hi This is my request. It's a mistake, but I hope that the basic idea may carry out. Cost_before_Decision is a column by using an alter table statement, I added:
    UPDATE fraud_nov_14_final
    SET Cost_before_Decision = (select Cost_Prior 
                                from    fraud_nov_14_final ff
                                      ,(select cla_case_no, sum(case when decline = 1 or decline = 2  
                                                                  THEN (nvl(total_cost_adj_old,0) + nvl(decline_estimate,0)) 
                                                                  ELSE Total_Cost 
                                                                  END) Cost_Prior
                                        from reporting.ci_final@test
                                            group by cla_case_no) z
                                                    where ff.cla_case_no = z.cla_case_no)
    Error I get is:
    Error report:
    SQL error: ORA-01427: einreihig subquery returns multiple rows
    01427 00000 - "einreihig subquery returns several lines.

    Thanks in advance for your help:

    Banner:
    Oracle Database 11 g Release 11.2.0.2.0 - 64 bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    "CORE 11.2.0.2.0 Production."
    AMT for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production

    Try this

    update fraud_nov_14_final a
       set cost_before_decision = (
                        select cost_prior
                          from (
                             select cla_case_no, sum(case when decline = 1 or decline = 2  then (nvl(total_cost_adj_old,0) + nvl(decline_estimate,0)) else total_cost end) cost_prior
                               from reporting.ci_final@test
                             group by cla_case_no
                               ) b
                                   where a.cls_case_no = b.cls_case_no
                         )
    
  • Update of table with no column

    Hello

    Why oracle is that although the statement is incorrect? is there any docid for this?

    SQL > select banner version of v$.

    BANNER
    ----------------------------------------------------------------
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64 bit Production
    PL/SQL Release 9.2.0.8.0 - Production
    CORE Production 9.2.0.8.0
    AMT for Solaris: 9.2.0.8.0 - Production Version
    NLSRTL Version 9.2.0.8.0 - Production


    SQL > desc one
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    AA NUMBER (1)
    BB NUMBER (1)

    SQL > desc b
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    AA NUMBER (1)
    CC NUMBER (1)

    SQL > select * from a;

    AA BB
    ---------- ----------
    1 1
    2 2
    3 3
    4 4
    3 s

    SQL > select b bb;
    Select bb b
    *
    ERROR on line 1:
    ORA-00904: "BB": invalid identifier


    SQL > update a game aa = 3 where bb (select b BB); -> bb of the column does not exist in table b

    5 lines to date.

    SQL > select * from a;

    AA BB
    ---------- ----------
    1 of 3
    1 p
    3 3
    3 4
    6 P

    Thank you
    Shanker

    No specific document. He has correlated subqueries. There is, of course, usually join condition.

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/statements_10002.htm#i2066912

  • How can I update this table with values from another table?

    Hello

    I have a table 'governed '. I want to replace the values in the column "regies.agent" by the value of the column "regies_personnes.id."
    As you can see the tables have a column of common values. IE regies.agent = regies_personnes.nom

    Table 'governed ':
    Insert into 'authorities' (AGENT) values ('Humberdot Alain");
    Insert into 'authorities' (AGENT) values ("Danard Patrick");

    Table 'regies_personnes ':
    Insert into REGIES_PERSONNES (NAME, ID) values ("Humberdot Alain", 1);
    Insert into REGIES_PERSONNES (NAME, ID) values ("Danard Patrick", 2);

    Before having it
    SQL > select agent of authorities;
    Humberdot Alain
    Patrick Danard

    After the update, the result should be
    SQL > select agent of authorities;
    1
    2

    Thank you for your kind reply.

    You can

    update regies r set agent = (select id from regies_persones p where r.agent = p.nom)
      where exists (select id from regies_persones p where r.agent = p.nom)
    

Maybe you are looking for