Need to update several lines in a multi-line table in another

I came to the conclusion that I can't do that because of the absence of a unique key that is related, but maybe you can help me with a solution. I tried all of the solutions posted here, but they do not work in my scenario. I have codes in a table that is a list of codes to the related market which they should be used for. I have a second table of customers who do not have the code assigned to them until they are sent to an advertisement. This table has the market_id for each customer and the table of codes has the market_id associated with each code. I want to update the customer table with one of the associated with the market_id mergecodes - but between the two tables you isn't a unique key to connect. I thought I could just update the records which had corresponding market_ids, but nothing works. In the two tables below, I want to be able to update t3tm.mergecode with one of the mergecodes that has the same market_id ("Austin") in t3mc. It does not matter that it is associated with a particular customer.

{code}

create table T3mc (use of mergecode varchar (10), market_id varchar (25), week number, varchar2 (5));

Insert into T3mc values ('A8976","Austin", 2,");
Insert into T3mc values ('A8988","Austin", 2,");
Insert into T3mc values ("A9900", "Houston", 2, ");
commit;

create table T3tm (name varchar (20), market_id varchar (25), mergecode varchar (10), identification number);

insert into T3tm Values ('Smith', 'Austin' ", 1);
insert into T3tm Values ("Jones", "Austin", ", 2);
commit;
{code}

{code}
Select * from T3mc;
MARKET_ID, WEEK, USED, MERGECODE
Austin 2 A8976 (null)
Austin 2 A8988 (null)
Houston 3 A9900 (null)
Select * from T3tm;

LAST_NAME, MARKET_ID, MERGECODE ID
Austin Smith (null) 1
Austin Jones (null) 2
{code}

ti3r wrote:
In the two tables below, I want to be able to update t3tm.mergecode with one of the mergecodes that has the same market_id ("Austin") in t3mc. It does not matter that it is associated with a particular customer.

{code}
update of T3tm one
Set mergecode =)
Select mergecode
of T3mc b
where b.market_id = a.market_id
and rownum = 1
)
where market_id in)
Select market_id
of T3mc
)
/

2 lines to date.

SQL > select *.
2 of T3tm
3.

LAST_NAME MARKET_ID MERGECODE ID
-------------------- ------------------------- ---------- ----------
Austin A8976 Smith 1
Austin A8976 Jones 2

SQL >
{code}

SY.

Tags: Database

Similar Questions

  • Updated several lines with different values

    Hello!
    I have a problem. I need to update more than 1000 lines with different values. How can I do?
    For exsample I have table:
    ID; color, date,
    1 red
    2 green
    3 white

    I need to update the date field.

    Update table
    Set date = '01.02.03'
    where id = 1

    Update table
    Set date = '01.03.03'
    where id = 2


    Maybe it's how to update multiple rows in a single request?

    Sorry for my bad English.
    Thank you!

    Hello

    You can try this

    UPDATE TABLE SET DATE = CASE
                        WHEN ID = 1 THEN TO_DATE('01-02-03','DD-MM-RR')
                        WHEN ID = 2 THEN TO_DATE('01-03-03','DD-MM-RR')
                        END
    

    see you soon

    VT

  • Updated several lines using BOX WHEN

    I have the table ACCOUNT of structure as follows:

    Account_id ACCOUNT_STATUS
    0044607212
    0420562915
    6012720653

    I need to update the three rows at a time using a SELECT statement such that the second column will be respectively 5, 3, 2.
    I used the following query but it seems something is missing

    UPDATE ACCOUNT
    SET ACCOUNT_STATUS = CASE  
    WHEN ACCOUNT_STATUS = '004460721' THEN 5 
    WHEN ACCOUNT_STATUS = '042056291' THEN 3 
    WHEN ACCOUNT_STATUS = '601272065' THEN 2 
    WHERE ACCOUNT_ID IN ('004460721','042056291','601272065') 

     

    My question is this correct way? If not, I can use CASE WHEN statement and how or I only have the choice of use of SUB-SELECT to achieve this objective in a single statement?

    Don't know what SQLFiddle is and the DB, it uses, but it worked at Oracle 10.2.0.5:

    create table account (key primary number account_id,)
    account_status varchar2 (30));

    insert into a values (1, '5') account;
    insert into a values (2, '3') account;
    insert into a values (3, '2') account;

    update account

    Set the account_status CASE account_id =

    WHEN 1 then "2"

    WHEN THEN 2 '5'

    WHEN 3 THEN "3"

    END

    WHERE account_id IN (1,2,3);

    Select *.

    account;

    ACCOUNT_ID ACCOUNT_STATUS

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

    1                      2

    2                      5

    3                      3

  • Need to send several lines in mail utility

    HI Experts,

    I'm using ODI 11 g.

    In my ODI package I use a Variable when I need to write this query

    Select campgn_no. »  '|| LPAD (lang, 4,' ') | »   '|| LPAD (total, 6,' ') | »  '|| (select TO_DATE(CELL_STRDT,'YYYY/MM/DD')
    ||'      '|| CELL_END_DATE
    OF sp_product m, sp_dom o
    WHERE m.offer_id = o.offer_id AND o.campgn_no IN (SELECT DISTINCT T.CAMPGN_NO FROM SP_ODI_TEMP T WHERE T.CAMPGN_ID ='lm10303 "") and rownum = 1) | Chr (10) Lang_Break_Up
    de)
    Select o.campgn_no, campgn_no, lang, count (1) total m.lang
    of sp_product m, sp_dom o
    where m.offer_id = o.offer_id
    AND O.CAMPGN_NO IN (SELECT DISTINCT T.CAMPGN_NO FROM SP_ODI_TEMP T WHERE T.CAMPGN_ID = 'lm10303')
    O.CAMPGN_NO GROUP, ORDER BY O.CAMPGN_NO M.LANG);

    This qqery returns values like

    LON01 E 4 MARCH 10, 13 2 FEBRUARY 13

    LON02 E 2 MARCH 10, 13 2 FEBRUARY 13

    LON03 E 4 MARCH 10, 13 2 FEBRUARY 13

    LON04 E 3 MARCH 10, 13 2 FEBRUARY 13

    Just after this Variable, I am setting a utility of mail to send this result.

    But after running the post office, it sends only one line of result.
    LON01 E 4 MARCH 10, 13 2 FEBRUARY 13

    I need to send multiple lines ... How to do this... Please help me on this.

    Thank you
    Lony

    Hello

    If you have less than 4000 tank, you can use this workaround with listagg.

    LISTAGG (last_name, ';) ')

    THE Group (ORDER BY hire_date, last_name)

    Select LISTAGG (campgn_no |) »  '|| LPAD (lang, 4,' ') | »   '|| LPAD (total, 6,' ') | »  '|| (select TO_DATE(CELL_STRDT,'YYYY/MM/DD')

    ||'      '|| CELL_END_DATE , '

    ') THE Group (ORDER BY campgn_no)

    OF sp_product m, sp_dom o

    WHERE m.offer_id = o.offer_id AND o.campgn_no IN (SELECT DISTINCT T.CAMPGN_NO FROM SP_ODI_TEMP T WHERE T.CAMPGN_ID ='lm10303 "") and rownum = 1) | Chr (10) Lang_Break_Up

    Of...



    Basically you tell Oracle to consider only one line which consist as the concatenation of your line with a \r\n


    Let me know

  • updated several lines in a table table anthor

    I need to transfer all coloumn table full_name 'name_f' in coloumn full_name lines in the table "new_osama".


    Update new_osama t
    Define full_name = (select full_name of name_f u
    where u.EMP_CODE = t.emp_code
    and t.full_name is null)

    It back
    ERROR on line 2:
    ORA-01427: einreihig subquery returns multiple rows
    update new_osama t
    set full_name=(select full_name from name_f u
    where u.EMP_CODE=t.emp_code
    and t.full_name is null and rownum = 1)
    

    Table of"name_f" have repeat lines for some 'emp_code '.

    select count(emp_code) from name_f;
    /
    select count(distinct emp_code) from name_f;
    /
    
  • How can I update several lines based on the comparison of the fields table 1 and 2

    I create the following SQL to test what I found a method to update the records where the fields below the game, but what ends up happening is that the update functions works the first time and then basically updates everything to null. I don't understand what I'm doing wrong. New to this.

    UPDATE SLS_HDR B
    DEFINE (B.ORD_DT, B.SHIP_ADD_CD, B.INV_ADD_CD, B.LOB, B.STATUS,
    B.ORD_TYPE, B.HDR_ROUTE, B.PRICE_LIST, B.CUST_ORDER, B.REF_A, B.REF_B,
    B.ORD_REF, B.ORD_DISC, B.SREP, B.SREP2, B.PLAN_DEL_DT, B.TXTA, B.TXTB,
    B.INV_CONTACT, B.SHIP_CONTACT, B.SOLD_CONTACT, B.PAY_CONTACT, B.ORD_AMT, B.UPDATED_DT)
    (SELECT =
    A.ORD_DT, A.SHIP_ADD_CD, A.INV_ADD_CD, A.LOB, A.STATUS,
    A.ORD_TYPE, A.HDR_ROUTE, A.PRICE_LIST, A.CUST_ORDER, A.REF_A, A.REF_B,
    A.ORD_REF, A.ORD_DISC, A.SREP, A.SREP2, A.PLAN_DEL_DT, A.TXTA, A.TXTB,
    A.INV_CONTACT, A.SHIP_CONTACT, A.SOLD_CONTACT, A.PAY_CONTACT, A.ORD_AMT, SYSDATE
    Of
    SLS_HDR_TEMP HAS
    WHERE
    A.FIN_COMP = B.FIN_COMP AND
    A.LOG_COMP = B.LOG_COMP AND
    A.ORD_NO = B.ORD_NO AND
    A.TRANS_DT = B.TRANS_DT AND
    A.BP_TYPE = B.BP_TYPE AND
    A.STATUS <>B.STATUS);

    Can someone advise?
    Thank you

    Published by: 903292 on December 19, 2011 13:15

    you don't have a where clause in your update so no-matched lines will be updated with null values

    UPDATE SLS_HDR B
    SET ( B.ORD_DT, B.SHIP_ADD_CD, B.INV_ADD_CD, B.LOB, B.STATUS,
    B.ORD_TYPE, B.HDR_ROUTE, B.PRICE_LIST, B.CUST_ORDER, B.REF_A, B.REF_B,
    B.ORD_REF, B.ORD_DISC, B.SREP, B.SREP2, B.PLAN_DEL_DT, B.TXTA, B.TXTB,
    B.INV_CONTACT, B.SHIP_CONTACT, B.SOLD_CONTACT, B.PAY_CONTACT, B.ORD_AMT,B.UPDATED_DT )
    = (
              SELECT
              A.ORD_DT, A.SHIP_ADD_CD, A.INV_ADD_CD, A.LOB, A.STATUS,
              A.ORD_TYPE, A.HDR_ROUTE, A.PRICE_LIST, A.CUST_ORDER, A.REF_A, A.REF_B,
              A.ORD_REF, A.ORD_DISC, A.SREP, A.SREP2,A.PLAN_DEL_DT, A.TXTA, A.TXTB,
              A.INV_CONTACT, A.SHIP_CONTACT, A.SOLD_CONTACT,A.PAY_CONTACT, A.ORD_AMT, SYSDATE
              FROM
              SLS_HDR_TEMP A
              WHERE
              A.FIN_COMP = B.FIN_COMP AND
              A.LOG_COMP = B.LOG_COMP AND
              A.ORD_NO = B.ORD_NO AND
              A.TRANS_DT = B.TRANS_DT AND
              A.BP_TYPE = B.BP_TYPE AND
              A.STATUS= B.STATUS
         )
    WHERE EXISTS
    (
         select null from SLS_HDR_TEMP A
         WHERE
         A.FIN_COMP = B.FIN_COMP AND
         A.LOG_COMP = B.LOG_COMP AND
         A.ORD_NO = B.ORD_NO AND
         A.TRANS_DT = B.TRANS_DT AND
         A.BP_TYPE = B.BP_TYPE AND
         A.STATUS= B.STATUS
    )
    

    OR using Merge

    Merge into SLS_HDR B
    using SLS_HDR_TEMP A
    on (A.FIN_COMP = B.FIN_COMP AND
    A.LOG_COMP = B.LOG_COMP AND
    A.ORD_NO = B.ORD_NO AND
    A.TRANS_DT = B.TRANS_DT AND
    A.BP_TYPE = B.BP_TYPE AND
    A.STATUS= B.STATUS)
    when matched then update set (B.ORD_DT, B.SHIP_ADD_CD, B.INV_ADD_CD, B.LOB, B.STATUS,
    B.ORD_TYPE, B.HDR_ROUTE, B.PRICE_LIST, B.CUST_ORDER, B.REF_A, B.REF_B,
    B.ORD_REF, B.ORD_DISC, B.SREP, B.SREP2, B.PLAN_DEL_DT, B.TXTA, B.TXTB,
    B.INV_CONTACT, B.SHIP_CONTACT, B.SOLD_CONTACT, B.PAY_CONTACT, B.ORD_AMT,B.UPDATED_DT ) = (A.ORD_DT, A.SHIP_ADD_CD, A.INV_ADD_CD, A.LOB, A.STATUS,
    A.ORD_TYPE, A.HDR_ROUTE, A.PRICE_LIST, A.CUST_ORDER, A.REF_A, A.REF_B,
    A.ORD_REF, A.ORD_DISC, A.SREP, A.SREP2,A.PLAN_DEL_DT, A.TXTA, A.TXTB,
    A.INV_CONTACT, A.SHIP_CONTACT, A.SOLD_CONTACT,A.PAY_CONTACT, A.ORD_AMT, SYSDATE)
    

    HTH...

    Thank you

  • How to use the checkbox to update several lines

    Hi all

    I'm new to apex and I have a problem now. I find this code somewhere:

    BEGIN

    FOR I IN 1... APEX_APPLICATION. G_F01. COUNTING LOOP

    REMOVE FROM THE ASER

    WHERE ID = TO_NUMBER (APEX_APPLICATION. G_F01 (I));

    END LOOP;

    END;

    It can remove selected items, now I want to make some modifications to it.

    I want to update some columns when I ticked the box. How to make this change? I mean, like this:

    UPDATE ASER SET STATUS = '1' when I selected items

    Can you help me? Thank you!

    Hello

    I don't know exactly what you want to do, but if I am guessing right then of course you want updated also based on the elements of the selected check box.

    
    BEGIN
     FOR I IN 1 .. APEX_APPLICATION.G_F01.COUNT LOOP
    
       DELETE FROM ASER
      WHERE ID=TO_NUMBER(APEX_APPLICATION.G_F01(I)) ;
    UPDATE APSER
    SET STATUS = 1
    WHERE ID=TO_NUMBER(APEX_APPLICATION.G_F01(I)) ;
       END LOOP;
    
      END;
    

    But if not and you try rather to use these values to update another table after Session State is the way to go.

    Kind regards

    Benjamin.

  • How to upgrade several lines

    Hello world!

    As I said... is it possible to update several lines in the studio ODI 12 c?

    Thanks anyway!

    Can you close the thread and then marking it as answered.

  • need help to trigger to update the change of columns of a table

    Hi all
    I need help in the manufacture of change update trigger in the columns from one table to another table.
    For example, table (col1 col 2 col 3 col 4 col 5 samplea
    .. .Col 20

    Now if I do any change in one of the data column must be changed to
    sample_copya... table that contains duplicate column

    So for this I thought to create a trigger with the following logic



    If updating (col1) then
    Update sample_copya set col1: =: new.col1 where n ° 1 =: new.no1;
    Otherwise, if the update (col2) then
    Update sample_copya set col2: =: new.col2 where n ° 1 =: new.no1;
    Otherwise, if the update (col3) then
    Update sample_copya set col3: =: new.col3 where n ° 1 =: new.no1;

    end if;
    But how doi handle if all columns are changed or say 2 columns record the number of columns is more than 20...
    I would like to know if there is a simpler method to achieve...
    Thank you

    susf wrote:
    Hi all
    I need help in the manufacture of change update trigger in the columns from one table to another table.
    For example, table (col1 col 2 col 3 col 4 col 5 samplea
    .. .Col 20

    Now if I do any change in one of the data column must be changed to
    sample_copya... table that contains duplicate column

    So for this I thought to create a trigger with the following logic

    If updating (col1) then
    Update sample_copya set col1: =: new.col1 where n ° 1 =: new.no1;
    Otherwise, if the update (col2) then
    Update sample_copya set col2: =: new.col2 where n ° 1 =: new.no1;
    Otherwise, if the update (col3) then
    Update sample_copya set col3: =: new.col3 where n ° 1 =: new.no1;

    end if;
    But how doi handle if all columns are changed or say 2 columns record the number of columns is more than 20...
    I would like to know if there is a simpler method to achieve...
    Thank you

    What is the purpose of this trigger?
    How can you be sure that ' where n ° 1 =: new.no1 "is true?
    How does line in the SAMPLE_COPYA table at the start?
    only the last modified value will lie in SAMPLE_COPYA than the previous values is written more

  • Concatenate several lines in a Unique identifier

    Hi all

    I need to concatenate several lines in a unique identifier

    So, my unique identifiers are name and email_id columns.


    It is 1:M relationship as eponymous and email_id can have n number of different products, now I should


    So let's say that the name = xyz and [email protected] has 5 rows with different product info for them.

    Product # #Name #email_id

    XYZ [email protected] Ora
    XYZ [email protected] sql
    XYZ [email protected] siebel
    XYZ [email protected] erp
    XYZ [email protected] crm

    My end result would be after concatenation (seen / as a delimiter between each concatenated row):

    Product # #Name #email_id
    XYZ [email protected] Ora/sql / / erp/crm siebel

    Need help please, after several attempts, I can't seem to make it work. I thank in advance

    Published by: user13080645 on January 22, 2011 07:33

    Hello

    You should look at using STRAGG or LISTAGG - take a look on: http://www.dba-oracle.com/t_display_multiple_column_values_same_rows.htm or search the Forum of SQL for these

    Andy

  • Update a line based on the minimum value

    I need to update a value in row in a table (table 1), which has a relationship one may with another table (table 2) based on priority. Here is the data structure and sample of the table. I have a merge statement that can do all this, but it takes too much to run if the data into table2 are enormous.

    I want to reduce the execution time, can someone suggest me another way to achieve this.
    --Table Definition
    CREATE TABLE TABLE_1 (ENAME VARCHAR2(20), ID NUMBER(20), DISPLAY_NAME VARCHAR2(20), PRIMARY KEY (ENAME));
    CREATE TABLE TABLE_2 (ENAME VARCHAR2(20), DISPLAY_NAME VARCHAR2(20), PRIORITY NUMBER(1));
    
    --Sample data
    INSERT INTO TABLE_1 (ENAME,ID) VALUES ('EMP1','1000');
    INSERT INTO TABLE_1 (ENAME,ID) VALUES ('EMP2','2000');
    
    INSERT INTO TABLE_2 (ENAME,DISPLAY_NAME,PRIORITY) VALUES ('EMP1','APPLE',1);
    INSERT INTO TABLE_2 (ENAME,DISPLAY_NAME,PRIORITY) VALUES ('EMP1','DELL',2);
    INSERT INTO TABLE_2 (ENAME,DISPLAY_NAME,PRIORITY) VALUES ('EMP1','MS',NULL);
    
    --Merge to perfor the update
    MERGE INTO TABLE_1 T USING 
    (select ename, display_name from TABLE_2 where (ename,priority) in (
    select distinct ename, min(priority) over (partition by ename) from TABLE_2 min_prior)) Q
    ON (T.ENAME = Q.ENAME)
    WHEN MATCHED THEN UPDATE SET DISPLAY_NAME = Q.DISPLAY_NAME;

    Maybe (filtering of priority of the join before fusion as table_2 is huge)

    merge into table_1 t
    using (select ename,display_name
             from (select t2.ename,t2.display_name,
                          row_number() over (partition by t2.ename order by t2.priority) rn
                     from table_1 t1,
                          table_2 t2
                    where t1.ename = t2.ename
                  )
            where rn = 1
          ) q
       on (t.ename = q.ename)
     when matched
     then update
             set t.display_name = q.display_name
    

    Concerning

    Etbin

  • Need help updated the VMX file on several Virtual Machine

    All,

    Can anyone help with a problem I'm having?  Here is a brief explanation of what is happening and what we need to solve.

    Recently we found out that we need to add a line in the file VMX of several virtual machines.  In the past, I was able to do this, but would have cold start the virtual machine for the changes to take effect.  Starts cold won't be a problem, because we can program it.

    However, no one knows a way to add this line in the file VMX virtual machines in a cluster.

    Here's the line I need added:

    Devices.hotplug = "false".

    Here is a script that was used earlier (esx 3.0 days) to keep the VM tools updated on reboot.  At this point, if the virtual machine has been turned on, this change could not do through the UI.  However, this script worked to update the .vmx file and then we have cold reboots for the changes to take effect.

    Get-viserver - < Server > - < user > - < password >

    $viview = get-Cluster-name NOMCLUSTER | Get - VM | foreach-object {get-view ($_.ID)}
    $viview | {foreach-object
    $vmConfigSpec = new-Object VMware.Vim.VirtualMachineConfigSpec
    $vmConfigSpec.Tools = new-Object VMware.Vim.ToolsConfigInfo
    $vmConfigSpec.Tools.afterPowerOn = 'True '.
    $vmConfigSpec.Tools.afterResume = 'True '.
    $vmConfigSpec.Tools.beforeGuestStandby = 'True '.
    $vmConfigSpec.Tools.beforeGuestShutdown = 'True '.
    $vmConfigSpec.Tools.ToolsUpgradePolicy = "UpgradeAtPowerCycle".
    $_. ReconfigVM ($vmConfigSpec)
    }

    The exact script can be found in Disable HotPlug

  • Update of several lines using the join condition

    Hi all

    CREATE OR REPLACE
    PROCEDURE update_t
    IS

    BEGIN
    SheikYerbouti IN (SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME FROM hr.employees)
    LOOP
    UPDATE
    HR.employees1
    SET
    FOCA =)
    Select concat (FIRST_NAME, LAST_NAME) in the hr.employees where SheikYerbouti. EMPLOYEE_ID = 197);
    END LOOP;
    END update_t;
    /

    I'm trying to update column Foca Employees1 table. When I run this procedure, I get the error

    Error report:
    ORA-01427: einreihig subquery returns multiple rows
    ORA-06512: at "SYSTEM. UPDATE_T", line 13
    ORA-06512: at line 1
    01427 00000 - "einreihig subquery returns several lines.

    Please let me know a solution for this.

    Thank you
    Mathon

    Hello Mathieu,
    in your internal SQL result set is not limited to just one line.
    Try this

    UPDATE hr.employees1 SET
    FIRST_LAST= (select concat(FIRST_NAME,LAST_NAME) from hr.employees where emp_rec.EMPLOYEE_ID=hr.employees.employee_id);
    

    Your version had no restrictions on selected lines of hr.employees. You gave a where condition clause that is not related to the query.

    The best solution for your problem is to avoid completely any PL/SQL loop. You can try something like this:

    update
       (select
           e1.first_last,
           e.first_name,
           e.last_name
        from
           hr.employees1 e1,
           hr.employees e
        where
           e1.employee_id=e.employee_id) set
       first_last=first_name||last_name;
    

    But beware, the updates on the joints work only under certain restrictions. The key of the table to be updated must be the join key. (key preserved is the word to look for).

    Hope that helps,
    dhalek

  • Update several fields... need advice.

    Hi all

    I have a bit of a problem with the update of several fields in a table...

    Lets say we have two tables. Table one is called t_employe for example:
    create table t_employe (
    year number,
    line varchar2(1),
    counter number,
    value number)
    To set random data in the table:
    insert all
    into t_employe (year, line,counter, value)
    values(2011,'3','2946','3344')
    into t_employe (year, line,counter, value)
    values(2011,'3','2947','4433')
    into t_employe (year, line,counter, value)
    values(2011,'3','2948','4455')
    into t_employe (year, line,counter, value)
    values(2011,'3','2949','5544')
    select * from dual
    OK second table would be:
    create table to_update (
    year number,
    line varchar2(1),
    counter number,
    date_pos_1 date,
    value_pos_1 number,
    date_pos_2 date,
    value_pos_2 number,
    date_pos_3 date,
    value_pos_3 number,
    date_pos_4 date,
    value_pos_4 number,
    date_pos_5 date,
    value_pos_5 number)
    Data:
    insert all
    into to_update (year, line,counter, date_pos_1,value_pos_1,date_pos_2,value_pos_2,date_pos_3,value_pos_3,date_pos_4,value_pos_4,date_pos_5,value_pos_5)
    values(2011,'3','2946',sysdate,'5434',null,null,null,null,null,null,null,null)
    into to_update (year, line,counter, date_pos_1,value_pos_1,date_pos_2,value_pos_2,date_pos_3,value_pos_3,date_pos_4,value_pos_4,date_pos_5,value_pos_5)
    values(2011,'3','2947',sysdate,'11',sysdate,'123',null,null,null,null,null,null)
    into to_update (year, line,counter, date_pos_1,value_pos_1,date_pos_2,value_pos_2,date_pos_3,value_pos_3,date_pos_4,value_pos_4,date_pos_5,value_pos_5)
    values(2011,'3','2948',sysdate,'33',sysdate,'44',sysdate,'8908',null,null,null,null)
    into to_update (year, line,counter, date_pos_1,value_pos_1,date_pos_2,value_pos_2,date_pos_3,value_pos_3,date_pos_4,value_pos_4,date_pos_5,value_pos_5)
    values(2011,'3','2949',sysdate,'1',sysdate,'2',sysdate,'343',sysdate,'78',null,null)
    select * from dual
    OK, now what I want to do is to update the fields in the table to_update where value_pos is NULL. To explain this better imagine
    Collums are from left to right in the order value_pos_1, the value_pos_2, the value_pos_3... Now, I would check for each line
    If value_pos_1 is null if it is then updated. Finist this row and move them to another. If not go to value_pos_2 in
    same rank and check again if the null value. If it's updated, if not, again to go forward. Each value_pos_X cullum has a date_pos_x cullom
    to be made same day as Value_pos_ cullums (if value_pos_X is null then date_pos_X coresponding will be null as well - is)
    a fact in my table).


    So is it feasible using only a single update?

    I managed to write a select statement by using the clause of the case that makes these things perfectly only for value_pos_X fields. I wonder if I can use in my
    Update statement?
    select 
    case when a.value_pos_1 is  null then b.value else 
         case when a.value_pos_2 is  null then b.value else
              case when a.value_pos_3 is  null then b.value else
                   case when a.value_pos_4 is  null then b.value else
                        case when a.value_pos_5 is  null then b.value else to_number('99999','9999,99')
    end
    end
    end
    end
    end  as value
    
    from to_update a,t_employe b
    where a.year = b.year
    and a.line= b.line
    and a.counter = b.counter 
    Suggestions how to extract it from?

    Thank you!
    SQL> select  *
      2    from  to_update
      3  /
    
          YEAR L    COUNTER DATE_POS_ VALUE_POS_1 DATE_POS_ VALUE_POS_2 DATE_POS_ VALUE_POS_3 DATE_POS_ VALUE_POS_4 DATE_POS_ VALUE_POS_5
    ---------- - ---------- --------- ----------- --------- ----------- --------- ----------- --------- ----------- --------- -----------
          2011 3       2946 27-AUG-11        5434
          2011 3       2947 27-AUG-11          11 27-AUG-11         123
          2011 3       2948 27-AUG-11          33 27-AUG-11          44 27-AUG-11        8908
          2011 3       2949 27-AUG-11           1 27-AUG-11           2 27-AUG-11         343 27-AUG-11          78
    
    SQL> merge
      2    into to_update a
      3    using (
      4           select  a.rowid rid,
      5                   b.value
      6             from  to_update a,
      7                   t_employe b
      8             where a.year = b.year
      9               and a.line= b.line
     10               and a.counter = b.counter
     11          ) b
     12     on (
     13         a.rowid = b.rid
     14        )
     15     when matched then update set value_pos_1 = nvl2(value_pos_1,value_pos_1,b.value),
     16                                  value_pos_2 = nvl2(value_pos_1,nvl2(value_pos_2,value_pos_2,b.value),value_pos_2),
     17                                  value_pos_3 = nvl2(value_pos_1 + value_pos_2,nvl2(value_pos_3,value_pos_3,b.value),value_pos_3),
     18                                  value_pos_4 = nvl2(value_pos_1 + value_pos_2 + value_pos_3,nvl2(value_pos_4,value_pos_4,b.value),value_pos_4),
     19                                  value_pos_5 = nvl2(value_pos_1 + value_pos_2 + value_pos_3 + value_pos_4,nvl2(value_pos_5,value_pos_5,b.value),value_pos_5)
     20  /
    
    4 rows merged.
    
    SQL> select  *
      2    from  to_update
      3  /
    
          YEAR L    COUNTER DATE_POS_ VALUE_POS_1 DATE_POS_ VALUE_POS_2 DATE_POS_ VALUE_POS_3 DATE_POS_ VALUE_POS_4 DATE_POS_ VALUE_POS_5
    ---------- - ---------- --------- ----------- --------- ----------- --------- ----------- --------- ----------- --------- -----------
          2011 3       2946 27-AUG-11        5434                  3344
          2011 3       2947 27-AUG-11          11 27-AUG-11         123                  4433
          2011 3       2948 27-AUG-11          33 27-AUG-11          44 27-AUG-11        8908                  4455
          2011 3       2949 27-AUG-11           1 27-AUG-11           2 27-AUG-11         343 27-AUG-11          78                  5544
    
    SQL> 
    

    Or yhis is perhaps more readable:

    merge
      into to_update a
      using (
             select  a.rowid rid,
                     b.value
               from  to_update a,
                     t_employe b
               where a.year = b.year
                 and a.line= b.line
                 and a.counter = b.counter
            ) b
       on (
           a.rowid = b.rid
          )
       when matched then update set value_pos_1 = case when value_pos_1 is null then b.value else value_pos_1 end,
                                    value_pos_2 = case when value_pos_1 is not null and value_pos_2 is null then b.value else value_pos_2 end,
                                    value_pos_3 = case when value_pos_1 + value_pos_2 is not null and value_pos_3 is null then b.value else value_pos_3 end,
                                    value_pos_4 = case when value_pos_1 + value_pos_2 + value_pos_3 is not null and value_pos_4 is null then b.value else value_pos_4 end,
                                    value_pos_5 = case when value_pos_1 + value_pos_2 + value_pos_3 + value_pos_4 is not null and value_pos_5 is null then b.value else value_pos_5 end
    /
    

    SY.

  • Satellite A45: need to update firmware on DVR K12D drive

    Hello...
    IM new here... Well, I have a toshiba > Satellite A45 Series... which had a DVD Multi Drive (DVR K12D) inside. The problem is that his operation stopped. Sometimes she would write a CD then sometimes it spoils my CD. I used on the media player were Verbatin, Imation, Supermedium, Sony.

    Well the reader works as a very short period and then dies OFF... every time I took it to the repair center...

    The drive has been changed now 4times by toshiba support. I asked for the release of Firmware from 1.05 to 1.15 or higher. They keep answering back telling me to ask pioneer. But it is an OEM obvious by toshiba.

    The player after having been changed stops working without delay of 2 to 3 months max 4 months time and den customer tried upgrading the drive by putting a higher config recorder multi disc double tht is the 8 GB one. The satellite detects that hardware.

    been 2 years now my readers send me problems such as:

    does not read DVD
    doeant read CD RW
    don't write CD/DVDs
    sometimes DVD detects any sometimes they detect its weird.

    The only solution is to update the firmware, but how can I do? I need the update of the firmware. I called toshiba WE also, they talked for two hours and then answer that I have to contact pioneer!

    Please help me!

    Vik!

    Hello

    CD/DVD players support generally not all means.
    As far as I know in the manual you will find a list of the CDs and DVDs is supported and it works properly.

    In addition, it seems that this device was designed for an American market and in this case, you should look at the Toshiba Site us.

    I checked this American site:
    http://www.CSD.Toshiba.com/cgi-bin/TAIS/Su/su_sc_home.jsp

    There, I found several notebooks A45 and the necessary drivers. I also found a driver for DVD rom and ram. It s not a firmware update but maybe it helps.

    However, on Toshiba Europe site, I found several updates firmware for the readers and the different European books but as I said at the beginning you have a US laptop and have to look on the American website. If you don't get an update of the firmaware if you ask the manufacturing of the car.

    In addition, I want to say that you can not be sure that, after updating the firmware of the player will not work correctly. This kind of malfunction looks like a defect of lens calibration and therefore only a replacement disc can solve this problem.
    If the drive has been replaced several times so I guess that the guarantee is valid and you will get a new.

Maybe you are looking for

  • Satellite P300 PSPCCE - Windows 7 drivers for touchpad

    Hello I recently did a clean install of Windows 7 (on Vista, entered with my laptop). Everything works fine, but one thing annoys me a bit - with Vista, I could use the top/right edges of the touchpad to scroll down/on in windows & documents. On Wind

  • M177fw MFP Scanner Error 22

    I too have a color LaserJet Pro MFP M177 which gives the same "Scanner Error 22".

  • Pocket drive Bay installation media.

    We have a HP Pavillion A6710T a 32 bit with a HP Pocket Media drive Bay OS installed Windows Vista.  We decided to upgrade to a HP Pavilion HPE H8 - 1360T running on a Windows 7, 64-bit OS, the drive Bay can be transferred from the old system to the

  • Help! stuck at installing service pack 1.

    Try to download service pack 1. He has been on stage 3 of 3 to 68% for 24 hours. What is going on?

  • What should you open files .p7s with?

    I don't know if I'm in the right forum or what half of this stuff. I just want to get a recommendation of what software use to open a file from a reliable source .p7s. There seems to be a lot of sites offering to download a viewer .p7s, and many of t