Update column based on values of same table

I have table T1 with 4 columns 'col1','col2','col3','col4', 'col5','col6' as follows
Col1     Col2     Col3     Col4     Col5     Col6
1111     City1     C     AA     DDD     A1
2222     City 1          DD     HHH     A1
3333     City2     B     EE     OOO     
4444     City 1     B     JJ     SSS     A1
5555     City2     C     KK     VVV     
6666     City2          RR     QQQ     
7777     City2     B     XX     BBB     
I have already updated Column 6with value ‘A1’ where Column 2 is ‘City1’.
Now I want to update col 6 where col2 is ‘S’ with following conditions
If Col 3 = ‘B’ then Col6 should be = col4
else it should be = col5

SET col6=DECODE(col3,'B',col4,col5)
WHERE col2='S'

Similar Messages

  • UPDATE value in column with value in SAME TABLE

    Hi all,
    Here's my issue...
    I have a table which records all incidents for a person.
    The table looks something like this:
    tbl_connect(person_Id NUMBer,
    OLD_ID VARCHAR2(24),
    CASE_NUMBER     VARCHAR2(10),
    CASE_TYPE     VARCHAR2(10),
    PERSON_ROLE     VARCHAR2(30),
    INCIDENT_TYPE     VARCHAR2(40));
    The table is populated from a source table with all fields except person_id. Person_id is a sequence number that gets generated if the person comitting the incident is a NEW PERSON to our system. OLD_Id is the unique identifier between the source table and tbl_connect to identify a person.
    The problem: If an existing person commits a new incident, a new record will be inserted into tbl_connect without PERSON_ID. Since the person already is in the database the person_id already exists in tbl_connect for that person. I now need to UPDATE person_id column with the person_id that already exists for this person. How can i achieve this.
    Ive been trying all sorts of update queries but nothing seems to work. ANy help will be appreciated. Thanks in advance.

    Frank,
    Thanks for the speedy reply. Here is a sample table.
    I know it's a bit confusing. The data that is being dumped into this table is information from a old system. The OLD_ID is in here because it is the relationship between this table and the old table. PERSON_ID is new to this system to identify a person uniquely. That is why i need them both in this table for right now.
    So say my tbl_connect got populated with new info from the old table. As you can see, old_id=567A has comitted another incident. Since he already exists in tbl_connect, now i need to update person_id with the value of 1. Does that make sense now????? If old_id did not exist, all i would do is insert a new row and set person_id to the next sequence number.
    TBL_CONNECT
    PERSON_ID OLD_ID      CASE_NUMBER CASE_TYPE          
    1     567A     12345          IR          
    1     567A     15236          MV
         567A     98547          IR<--newly inserted record of same person

  • Update table based on values from other table

    Hi,
    I am trying to update one table based on the values of another table. Since you can't use From in update statements, how do you execute this?
    For example i have to tables, Table A and Table B. I want to update a column or columns in Table A based on another value in Table B:
    So if the column in Table B was 1 then column in Table A would be Yes, if Table B was 2, then Table A would be Yes, if Table B was 3 then Table A would be N/A and so on...
    Any help would be appreciated.
    thanks,
    scott

    SQL> select * from t1;
    ID ST
    1
    2
    3
    SQL> select * from t2;
    NO
    1
    2
    3
    4
    SQL> update t1 set status=(select decode(no,1,'Y',2,'N','NA') from t2 where t1.id=t2.no);
    3 rows updated.
    SQL> select * from t1;
    ID ST
    1 Y
    2 N
    3 NA
    Daljit Singh

  • Custom table column based on value scale

    I want to custom table column based on the vaules.
    I understood I need to to /1000000 in the column definition and custom ###,###,###M.
    But sometimes it can be Kilos and sometimes Billions.
    I don't want to display 0.02M or 200000M.
    How can I define conditional custom according to the current value?

    Try doing what I said here and see if it works for you...
    Re: Represent numbers in thousands

  • Insert value into a column based on value of another column

    Hi,
    I am trying to insert a value into a record based on a column in
    the record, using a trigger. The complication arises because
    the new value is selected from the same table. For example:
    SELECT COL1, COL2, COL3, COL4 from TABLE1
    I want to set COL2 and COL3 based on the value of COL4. And to
    get the value of COL2 and COL3, I will go back to TABLE1 and set
    the condition to TABLE1.COL1 = :NEW.COL4
    I cannot seem to execute the trigger as I get the message "ORA-
    04091: table SYSTEM.TABLE1 is mutating, trigger/function may not
    see it" everytime.
    Is this the correct way to achieve what I wanted? Or is there
    another way?
    Appreciate your feedback. Thank you in advance.

    Hi,
    I am trying to insert a value into a record based on a column in
    the record, using a trigger. The complication arises because
    the new value is selected from the same table. For example:
    SELECT COL1, COL2, COL3, COL4 from TABLE1
    I want to set COL2 and COL3 based on the value of COL4. And to
    get the value of COL2 and COL3, I will go back to TABLE1 and set
    the condition to TABLE1.COL1 = :NEW.COL4
    I cannot seem to execute the trigger as I get the message "ORA-
    04091: table SYSTEM.TABLE1 is mutating, trigger/function may not
    see it" everytime.
    Is this the correct way to achieve what I wanted? Or is there
    another way?
    Appreciate your feedback. Thank you in advance. I'm not sure what you mean when you insert a value into a
    record, but if you are setting a value in a column of the same
    record using a trigger, then it's easy.
    :new.COL2 := ....:new.COL4...
    :new.COL3 := ....:new.COL4...
    The trigger must be 'INSERT or UPDATE' and 'FOR EACH RECORD'.
    If you are setting a different record in the same table, the
    solution is much more difficult.

  • Cursor and Update rows based on value/date

    SQL Server 2012
    Microsoft SQL Server Management Studio
    11.0.3128.0
    Microsoft Analysis Services Client Tools
    11.0.3128.0
    Microsoft Data Access Components (MDAC)
    6.1.7601.17514
    Microsoft MSXML 3.0 4.0 5.0 6.0 
    Microsoft Internet Explorer
    9.11.9600.16518
    Microsoft .NET Framework
    4.0.30319.18408
    Operating System
    6.1.7601
    The objective of this is to test the Cursor and use it on a production environment after this is fixed. What I would like to do is update rows in a column i duplicated originally called 'HiredDate' from AdventureWorks2012 HumanResources.Employee table. I
    made a duplicate column called 'DateToChange' and would like to change it based on a date I have picked, which returns normally 2 results (i.e. date is '04/07/2003'). The code runs but will not change both dates. It did run however with an error but changed
    only 1 of the 2 rows because it said ['nothing available in next fetch'].
    The code to add the columns and perform the query to get the results I am running this against:
    -- ADD column 'DateToChange'
    ALTER TABLE [HumanResources].[Employee] ADD DateToChange Date NOT NULL;
    -- Copy 'HireDate' data to 'DateToChange'
    UPDATE HumanResources.Employee SET DateToChange = HireDate;
    -- Change 'DateToChange' to NOT NULL
    ALTER TABLE [HumanResources].[Employee] ALTER COLUMN DateToChange Date NOT NULL;
    SELECT BusinessEntityID,HireDate, CONVERT( char(10),[DateToChange],101) AS [Formatted Hire Date]
    FROM HumanResources.Employee
    WHERE [DateToChange] = '04/07/2003';
    Code:
    USE AdventureWorks2012;
    GO
    -- Holds output of the CURSOR
    DECLARE @EmployeeID INT
    DECLARE @HiredDate DATETIME
    DECLARE @HiredModified DATETIME
    DECLARE @ChangeDateTo DATETIME
    --Declare cursor
    -- SCROLL CURSOR ALLOWS "for extra options" to pul multiple records: i.e. PRIOR, ABSOLUTE ##, RELATIVE ##
    DECLARE TestCursor CURSOR SCROLL FOR
    -- SELECT statement of what records going to be used by CURSOR
    -- Assign the query to the cursor.
    SELECT /*HumanResources.Employee.BusinessEntityID, HumanResources.Employee.HireDate,*/ CONVERT( char(10),[DateToChange],101) AS [Formatted Hire Date]
    FROM HumanResources.Employee
    WHERE DateToChange = '01/01/1901'
    /*ORDER BY HireDate DESC*/ FOR UPDATE OF [DateToChange];
    -- Initiate CURSOR and load records
    OPEN TestCursor
    -- Get first row from query
    FETCH NEXT FROM TestCursor
    INTO @HiredModified
    -- Logic to tell the Cursor while "@@FETCH_STATUS" 0 the cursor has successfully fetched the next record.
    WHILE (@@FETCH_STATUS = 0 AND @@CURSOR_ROWS = -1)
    BEGIN
    FETCH NEXT FROM TestCursor
    IF (@HiredModified = '04/07/2003')/*05/18/2006*/
    -- Sets @HiredModifiedDate data to use for the change
    SELECT @ChangeDateTo = '01/01/1901'
    UPDATE HumanResources.Employee
    SET [DateToChange] = @ChangeDateTo --'01/01/1901'
    FROM HumanResources.Employee
    WHERE CURRENT OF TestCursor;
    END
    -- CLOSE CURSOR
    CLOSE TestCursor;
    -- Remove any references held by cursor
    DEALLOCATE TestCursor;
    GO
    This query is run successfully but it does not produce the desired results to change the dates
    04/07/2003 to 01/01/1901.
    I would like the query to essentially be able to run the initial select statement, and then update and iterate through the returned results while replacing the necessary column in each row.
    I am also open to changes or a different design all together. 
    For this query I need:
    1. To narrow the initial set of information
    2. Check if the information returned, in particular a date, is before [i.e. this current month minus 12 months or
    12 months before current month]
    3. Next replace the dates with the needed date
    [Haven't written this out yet but it will need to be done]
    4. After all this is done I will then need to update a column on each row:
    if the 'date' is within 12 months to 12 months from the date checked
    NOTE: I am new to TSQL and have only been doing this for a few days, but I will understand or read up on what is explained if given enough information. Thank you in advance for anyone who may be able to help.

    The first thing you need to do is forget about cursors.  Those are rarely needed.  Instead you need to learn the basics of the tsql language and how to work with data in sets.  For starters, your looping logic is incorrect.  You open
    the cursur and immediately fetch the first row.  You enter the loop and the first thing in the loop does what?  Fetches another row.  That means you have "lost" the values from the first row fetched.  You also do not test the success of
    that fetch but immediately try to use the fetched value.  In addition, your cursor includes the condition "DateToChange = '01/01/1901' " - by extension you only select rows where HireDate is Jan 1 1901.  So the value fetched into @HiredModified will
    never be anything different - it will always be Jan 1 1901.  The IF logic inside your loop will always evaluate to FALSE.  
    But forget all that.  In words, tell us what you are trying to do.  It seems that you intend to add a new column to a table - one that is not null (ultimately) and is set to a particular value based on some criteria.  Since you intend the
    column to be not null, it is simpler to just add the column as not null with a default.  Because you are adding the column, the assumption is that you need to set the appropriate value for EVERY row in the table so the actual default value can be anything.
     Given the bogosity of the 1/1/1901 value, why not use this as your default and then set the column based on the Hiredate afterwards.  Simply follow the alter table statement with an update statement.  I don't really understand what your logic
    or goal is, but perhaps that will come with a better description.  In short: 
    alter table xxx add DateToChange date default '19010101'
    update xxx set DateToChange = HireDate where [some unclear condition]
    Lastly, you should consider wrapping everything you do in a transaction so that you recover from any errors.  In a production system, you should consider making a backup immediately before you do anything - strongly consider and have a good reason not
    to do so if that is your choice (and have a recovery plan just in case). 

  • Update column with ROW_NUMBER() value

    I have a column that I would like to update with a ROW_NUMBER() value partitioned by a specific column.
    CREATE TABLE ##tmp (id INT NULL,
    value1 VARCHAR(10),
    value2 VARCHAR(10))
    INSERT INTO ##tmp (value1,
    value2)
    VALUES ('A', 'asdfasdf'),
    ('A', 'asdf'),
    ('A', 'VC'),
    ('B', 'aasdf'),
    ('C', 'sdfgs'),
    ('C', 'xdfbhsdty'),
    ('C', '23sdgfg'),
    ('C', '234')
    -- update the ID column with the values below
    SELECT ROW_NUMBER() OVER (PARTITION BY Value1 ORDER BY Value2),
    Value1,
    Value2
    FROM ##tmp
    I have 14 million records.  Can someone explain the best way to do this?  Does the ORDER BY destroy performance for this many records?
    Thanks!

    CREATE TABLE ##tmp (id INT NULL,
    value1 VARCHAR(10),
    value2 VARCHAR(10))
    INSERT INTO ##tmp (value1,
    value2)
    VALUES ('A', 'asdfasdf'),
    ('A', 'asdf'),
    ('A', 'VC'),
    ('B', 'aasdf'),
    ('C', 'sdfgs'),
    ('C', 'xdfbhsdty'),
    ('C', '23sdgfg'),
    ('C', '234')
    -- update the ID column with the values below
    ; with cte as (
    SELECT ROW_NUMBER() OVER (PARTITION BY Value1 ORDER BY Value2) as RowNumber,
    Value1,
    Value2
    FROM ##tmp
    update cte
    set Id = RowNumber;
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • How to add column to report from the same table? Gives error now

    Steps to reproduce:
    Build a report on a table with easy report, select all columns
    Add column to the table
    Edit report and add column (one has to click Show Related Tables Only: No to view the same table!)
    Report will give error as it will be build as
    SELECT ... FROM table1, table1

    AH HAAA!!!!
    And I was afraid to convert from the "SQL (Structured Query)" to "SQL". Probably because I blew up my other reports...
    Thanks!

  • To insert values in same table

    hi,
      based on date difference  i want insert the data  in same table
    eg: if date diff is 2
      i want insert 2 rows in a same table
    how to resolve this
    Edited by: hareeshKR on Oct 1, 2011 9:10 AM

    Hi,
    Please explain further what is your goal, what table are trying to add?
    Because inserting data in a table is not supported.
    Thanks.
    Clint

  • Need SQL to update Column based on latest value

    EFF_DTE     EXCH_FROM_CTRY_CD     EXCH_TO_CTRY_CD     SECTY_LST_PRCE     SECTY_MTH_AVG_PRCE      New Col In View
    1/1/2013     USD     MXN     12.988     12.988     12.88672
    1/2/2013     USD     MXN     12.988     12.988     12.88672
    1/3/2013     USD     MXN     12.9658     12.9806     12.88672
    1/4/2013     USD     MXN     12.7488     12.92265     12.88672
    1/5/2013     USD     MXN     12.743     12.88672     12.88672
    I have above table and I need to populate New Col using view. New Column value should be Latest date SECTY_MTH_AVG_PRCE . For example If today date is 1/5/2013 date New Col should populate value 12.88672 for all the records for that month only. So every day when new MTH AVG Rate come then it should populate latest value of Secty_MTH_AVG_PRCE to New Col.
    The New Col should populate with latest Avg_Prc only for that month. If New Month Start then new col should now update all records value but It should update only for June month Only.
    Please help me to make a view query. and let me know if any query?
    Thanks in advance.

    Hi,
    This sounds like a job for the analytic FIRST_VALUE function:
    MERGE INTO  table_x     dst
    USING  (
               SELECT  eff_dte
            ,        FIRST_VALUE (secty_mth_avg_price)
                        OVER (
                                  PARTITION BY  exch_from_ctry_cd, exch_to_ctry_cd  -- Maybe
                        ORDER BY      eff_dte  DESC
                              )     AS new_col
            FROM    table_x
            WHERE   eff_dte     >=           TRUNC (SYSDATE, 'MONTH')
            AND        eff_dte     < ADD_MONTHS (TRUNC (SYSDATE, 'MONTH'), 1)
           )          src
    ON     (    dst.eff_dte               = src.eff_dte
           AND  dst.exch_from_ctry_cd     = src.exch_from_ctry_cd     -- Maybe
           AND  dst.exch_to_ctry_cd          = src.exch_to_ctry_cd     -- Maybe
    WHEN MATCHED THEN UPDATE
    SET    dst.new_col     = src.new_col
    ;I'm just guessing at lots of things, because the question is so unclear.
    Is there a view involved in this problem, as well as the table? What role, if any, do exch_from_ctry_cd and exch_to_ctry_cd play in this problem. When you say "June", do you mean "February"?
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data. Make sure that no column is the same for all rows in the sample data. (E.g., have a least 2 distinct values for exch_to_ctry_cd.)
    If you're asking about a DML statement, such as UPDATE, the sample data will be the contents of the table(s) before the DML, and the results will be state of the changed table(s) when everything is finished.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • Update column based on a parsed value from another column

    <p>i have table1 which has&nbsp;description, region and division columns.&nbsp;If the "description like '% (%.% or %.%'" I want to parse the first '%.%' which has the values for&nbsp;'region.division' and update the table1.region
    and table1.division columns. </p><p></p><p>FOR EXAMPLE</p><p>DESCRIPTION, REGION, DIVISION</p><p>Total Employes (SouthEast.Florida or 111.22),,</p><p>WANT IT AS</p><p>Total Employes (SouthEast.Florida
    or 111.22),SouthEast,Florida</p><p>thanks in advance.</p><p></p>

    In my tests the following update of CTE works fine. Hopefully this will work for the real table as well although it is a good idea to always have primary key:
    DECLARE @t TABLE (
    DESCRIPTION VARCHAR(200)
    ,REGION VARCHAR(30)
    ,DIVISION VARCHAR(30)
    INSERT INTO @t (
    DESCRIPTION
    ,REGION
    ,DIVISION
    VALUES (
    'Total Employes (SouthEast.Florida or 111.22)'
    'Test no info'
    WITH cteParsed
    AS (
    SELECT *
    ,CASE
    WHEN DESCRIPTION LIKE '%(%.%'
    THEN substring(description, charindex('(', DESCRIPTION) + 1, len(Description))
    ELSE NULL
    END AS StartInfo
    FROM @t
    WHERE DESCRIPTION LIKE '%(%.%'
    AND len(Region) = 0
    AND len(Division) = 0
    ,cte
    AS (
    SELECT *
    ,substring(StartInfo, 1, charindex(' ', StartInfo) - 1) AS Rest
    FROM cteParsed
    UPDATE cte
    SET region = substring(Rest, 1, charindex('.', Rest) - 1)
    ,division = substring(Rest, charindex('.', Rest) + 1, len(Rest))
    SELECT *
    FROM @t; -- verify the changes taken place
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Update column based on sum of data from another table

    Hi We had two tables.
    Table 1: matusetrans
    ITEMNUM Location Quantity transdate
    AM1324 AM1 2 12-4-12
    AM1324 AM1 2 15-5-12
    AM1324 AM1 3 10-6-12
    AM1324 AM1 4 5-1-13
    AM1324 AM1 2 13-3-13
    AM1324 AM2 3 2-5-12
    AM1324 AM2 2 12-7-12
    AM1324 AM2 1 13-2-13
    Table 2: Inventory
    ITEMNUM STORELOC lastyear currentyear
    AM1324 AM1 need sum(quantity) here need sum(quantity)
    AM1324 AM2 need sum(quantity) here need sum(quantity)
    We have to update the last year and current year columns with sum of quantities for each item from matusetrans table based on date at different location in Inventory table.
    we had nearly 13,000 records(itemnum's with different location) in inventory table in DB we have to update entire records.
    Any help...How to write an sql queries to update lastyear and currentyear columns with sum of quantities based on itemnum and location in Inventory table
    Thanks
    Edit/Delete Message

    Try this
    SQL> select * from matusetrans;
    ITEMNU LOC   QUANTITY TRANSDATE
    AM1324 AM1          2 12-APR-12
    AM1324 AM1          2 15-MAY-12
    AM1324 AM1          3 10-JUN-12
    AM1324 AM1          4 05-JAN-13
    AM1324 AM1          2 13-MAR-13
    AM1324 AM2          3 02-MAY-12
    AM1324 AM2          2 12-JUL-12
    AM1324 AM2          1 13-FEB-13
    8 rows selected.
    SQL> select * from inventory;
    ITEMNU STO   LASTYEAR CURRENTYEAR
    AM1324 AM1          0           0
    AM1324 AM2          0           0
    SQL> merge into inventory i
      2  using (
      3            select itemnum
      4                 , location
      5                 , sum(decode(extract(year from transdate), extract(year from sysdate), quantity)) currentyear
      6                 , sum(decode(extract(year from transdate), extract(year from add_months(sysdate, -12)), quantity)) lastyear
      7              from matusetrans
      8             group
      9                by itemnum
    10                 , location
    11        ) t
    12     on (
    13           i.itemnum  = t.itemnum and
    14           i.storeloc = t.location
    15        )
    16  when matched then
    17    update set i.lastyear = t.lastyear
    18             , i.currentyear = t.currentyear
    19  /
    2 rows merged.
    SQL> select * from inventory;
    ITEMNU STO   LASTYEAR CURRENTYEAR
    AM1324 AM1          7           6
    AM1324 AM2          5           1
    SQL>

  • How to replace the string of column value with other column value in same table

      
    I have a temp table  which contains 
    Id  Name CTC   Address                      Content
    1    Ross  $200   6th block                  Dear #Name your  CTC  is #CTC and your address is  #address
    2   Jhon   $300   1oth cross                 Dear #Name your  CTC  is #CTC and your address is  #address
    Now i want to  select content    so that it should get  replace with  the respective  columns  and final output should come like this 
     Dear Ross your  CTC  is 200 and your address is    6th block  
      Dear Jhon your  CTC  is 300 and your address is   10th cross  
    Kindly suggest

    I think RSingh suggestion is ok ... what do you mean by another way? ...maybe something more generic?
    maybe build a table whith the list of col you need to "replace" and dinamically build the replace query ...
    declare @colList table(colName varchar(100))
    insert into @colList
    select 'name'
    union all select 'ctc'
    union all select 'address'
    declare @cmd varchar(2000)
    select @cmd='select '+ (select 'replace(' from @colList for xml path('') +' content '+
    (select ',''#'+ colName +''', '+ colName +')' from @colList for xml path(''))
    +' from YOURTABLENAME '
    exec (@cmd)
    or your request was different ?

  • Update column based on two columns

    Hi,
    MinValue     MaxValue    Desc
    -1                -1    
    -1                 1    
    -1                 2    
    0                  0    
    0                  1    
    0                  2 
    The above is my table which is having three columns MinValue, MaxValue, Desc. First two columns have data and I need to update the 3rd column 'Desc' based on two columns data.
    I need to update like,
    when MinValue=-1 and MaxValue=-1 then 'NotSpecified'
    when MinValue=-1 and MaxValue=1 then 'Up to 1'
    when MinValue=-1 and MaxValue=2 then 'Upto 2'
    when MinValue=0 and MaxValue=1 then 'At lest 1'
    when MinValue=0 and MaxValue=2 then 'At least 2'
    when MinValue=0 and MaxValue=3 then 'At least 3'
    The data in 'MaxValue' is like 1,2,3,4,5...50. So for each description it should append this value as mentioned above(till 'Up to 50', 'At least 50'). How can I do this with case statement?
    Thanks,
    Gangadhar

    declare @T table ( MinValue int,MaxValue int, [Desc] nvarchar(100) );
    insert @T ( MinValue, MaxValue )
    values ( -1, 1 ) , ( -1, 1 ) , ( -1, 2), ( 0, 0), ( 0, 1), ( 0, 2)
    select *
    from @T
    update @T
    set [Desc] = case
    when MinValue=-1 and MaxValue=-1 then 'NotSpecified'
    when MinValue=-1 and MaxValue=1 then 'Up to 1'
    when MinValue=-1 and MaxValue=2 then 'Upto 2'
    when MinValue=0 and MaxValue=1 then 'At lest 1'
    when MinValue=0 and MaxValue=2 then 'At least 2'
    when MinValue=0 and MaxValue=3 then 'At least 3'
    end
    select *
    from @T
    T-SQL Articles
    T-SQL e-book by TechNet Wiki Community
    T-SQL blog

  • How to create a table with a column which is value in other table?

    Hi to all,
    This is my first post n i changed my platform to ODI from DATASTAGE .Help me friends n i know basic steps in ODI 11 version which i got training in my company.I hope to get all ur support and can any one share ODI related documents.
    My question is ............
    T1 table>>>>>>>>>>
    service id ///////// attr.name /////////// attr.value
    S1 ///// product_code ///////// P1
    S1 ///// provider ///// pro1
    S2 ///// product_code ///// P2
    S3 ///// provider ///// pro3
    T2 table >>>>>>>>>>>>>>>
    service id ///// product_code ///// provider
    S1 ///// p1 ///// pro1
    S2 ///// p2 ///// nullvalue
    S3 ///// nullvalue ///// pro3
    I have a table T1 from that i should show the table T2 has output .Can any one say about how to write a logic and steps to be followed.
    Thanks in advance .
    Edited by: 854662 on Apr 26, 2011 1:59 AM

    Hi,
    Here u go.
    Interface 1:
    Put a filter in ur TABLE1 on attr.name='PRODUCT_CODE'.
    In Target TABLE2 map
    SERVICE_ID = TABLE1.SERVICE_ID
    PRODUCT_CODE=TABLE1.ATTR_VALUE
    Use IKM SQL Control Append.
    Interface 2:
    Put a filter in ur TABLE1 on attr.name='PROVIDER'.
    In Target TABLE2 map
    SERVICE_ID = TABLE1.SERVICE_ID
    PROVIDER=TABLE1.ATTR_VALUE
    Make SERVICE_ID as KEY (when u click on the target column in the Properties u can see KEY under Target Column Properties)and use IKM Oracle Incremental Update.
    P.S: I assume Oracle as source and target.
    And for documentation u can refer,
    https://apex.oracle.com/pls/apex/f?p=44785:24:4413167952886630::NO:24:P24_CONTENT_ID,P24_PREV_PAGE:5185,29
    http://odiexperts.com/
    And of course this OTN.
    Thanks,
    Guru

Maybe you are looking for