Mapping different same column value into different column based on conditio

Hi experts,
We have source as Oracle tables and target also Oracel tables.
Source
Column1|Column2|Column3
Target
trg1|trg2
I need to
insert the value of Column1 into trg1 where column2='xxx'
insert the value of column1 into trg2 where column3='yyy'
After giving the conditions on the mapping, the where conditions are getting clubed with and and I am getting different value than what is excepted. Like the similar way I have the same scenario for most of the columns in my target table. Suggest me how to do it.
Thanks in advance.

Hi,
I tried the mapping but getting duplicate records.
case1: Only AND condtion is getting applied automatically as per the joins between tables..i m not able to change the AND to OR condition since there are three table joins.
case2: when i try to execute the separate query for the column, i getting the values once put in case statement only NULL values are getting fetched.
As all my target mapping are like this...lot of issues are getting raised while fetching records...
I have given my scenario once again below.
src1
col1
src2
col1
col2
col3
col4
src3
col1
tar1
col1
col2
mapping given are
tar1.col1 = select src2.col3 where src2.col1='xxx' and src2.col2='yyy' and src2.col4=src1.col1
tar1.col2 = select src2.col3 where src2.col1='aaa' and src2.col2='bbb' and src2.col4=scr2.col1
Kindly suggest how to do the mapping in details...I am stuck bcoz of this mapping......thanks in advance.
Edited by: siva on Nov 23, 2011 12:34 PM

Similar Messages

  • Combine 2 specific column values into one column

    Is there an easy solution to combine column values that is in a group?
    In my report I have 1 column group named Activity_Area which has 5 different values Activity 1, Activity2...Activity5.
    Let's say I want to merge Activity 4 and Activity 5 and call it ActivityX and gives me the output as below
    Activity 1 | Activity 2 | Activity 3 | ActivityX

    Hi Jhonny86,
    According to your description, you create a field in database and it contains five values. Then you want to only display four values in report column group, and the last two values should be replaced by “ActivityX”, right?
    In your scenario, you can create an table like below:
    create table Act(id int,activity varchar(99))
    insert into Act select 1,'Activity 1'
    insert into Act select 2,'Activity 2'
    insert into Act select 3,'Activity 3'
    insert into Act select 4,'Activity 4'
    insert into Act select 5,'Activity 5'
    Then query the table with code like below in query designer, then add the field [Act] into the column group.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Split one column value into two columns using t-sql

    Hi All,
    I have one varchar column in a table.
    Col1
    ABC-12C4
    BC-A345
    CD
    XYZ
    How to split this into two columns like this using t-sql
    Col1   Col2
    ABC    12C4
    BC      A345
    CD     
    XYZ
    Thanks,
    RH
    sql

    assuming a static delimiter, and the split will end up with a max of 2 columns, something like this would work.  basically you just need to determine where the delimiter is, and then use the left and right functions to find the 2 pieces.
    declare @t table(value varchar(10))
    insert into @t(value)
    values
    ('ABC-12C4'), ('BC-A345'), ('CD'), ('XYZ')
    select
    case
    when charindex('-', value) != 0 then left(value, charindex('-', value) - 1)
    else value
    end as col1,
    case
    when charindex('-', value) != 0 then right(value, len(value) - charindex('-', value))
    else ''
    end as col2
    from @t

  • Single column value into two column of report

    Hi frnds,
    I have a column of Adress in my databse table from where i have to fetch values and show it a report
    able to get report but showing in single column if i take a printout paper will be wasted so I thought of passing these values to two different columns
    please help me in giving some suggestions

    In Oracle 9 you can get rid of the regex functions and use traditional SUBSTR, INSTR and REPLACE:
    ABSOLUTELY NOT TESTED...
    SELECT col1,SUBSTR ( ','||col2||',', instr(','||col2||',',',',lvl)+1,instr(','||col2||',',',',lvl+1)-instr(','||col2||',',',',lvl)-1)
      FROM table_name,
           (SELECT LEVEL lvl
              FROM (SELECT MAX (LENGTH (REPLACE ( col2, ',',''))) mx
                      FROM table_name)
            CONNECT BY LEVEL <= mx + 1)
    WHERE lvl - 1 <= LENGTH (REPLACE ( col2, ',',''));Max

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

  • How to copy one column BLOB value into another column of another database.

    How to copy one column BLOB value into another column of another database.
    BLOB value contains word document.
    I thought of copy the BLOB value into a text file and then update the new column value by the same text in textfile. Will this work?
    Is there any other better way to do this?

    You're welcome
    BLOB fields contains binary data. I don't think you can do this
    Also if I view the BLOB as text. Can I copy it and insert into the new database.
    I think your options are as I said. Datapump or CTAS
    Best Regards

  • How to insert column values into database as rows

    Hi,
    I have 8 columns and some not null columns. Based on not null columns I want to insert into table as rows. The 8 columns may contain values or no value. If the first column contains data, then I have to insert into one row. if the second column contains data I have to insert a row and in second column. respectively...So How can I insert column values into rows. Can I write 8 insert statements. (OR) is it possible to insert data from columns using where clause.
    Please help me out....
    Thanks in Advance

    Lines Table:
    line_id, orcl_bank_account_num, product_type, service_type, lease_type,
    funding_type, cpi, billing_frequency_unit_cd , annual_due_date ,
    pricing_start_date, pricing_end_date, install_date, contract_end_date ,
    prdct_replacement_cost_amt, cradle_replacement_amt, supranet_contract,
    issuance_fee, board_inactive_date, header_id, creation_date, last_modified_date,
    created_by_nam, modified_by_nam, activeinactive_flg, prdct_bill_amt_yr1,
    prdct_bill_amt_yr2, prdct_bill_amt_yr3, prdct_bill_amt_yr4, prdct_bill_amt_yr5,
    prdct_bill_amt_yr6, prdct_bill_amt_yr7, prdct_bill_amt_yr8, activation_fee_yr1,
    activation_fee_yr2, activation_fee_yr3, activation_fee_yr4, activation_fee_yr5,
    activation_fee_yr6, activation_fee_yr7, activation_fee_yr8,
    In this table the columns structure is :
    -- PRDCT_BILL_AMT_YR (1 to 8) NUMBER(14,4)
    -- ACTIVATION_FEE_YR (1 to 8) NUMBER(8,2)
    I have one more table:
    PRDCT_INS_AMT               NUMBER(14,4)
    ACTIVATION_FEE_AMT          NUMBER(14,4)
    I want to insert prdct_bill_amt_yr (1 to 8) columns data into PRDCT_INS_AMT column. similarly activation_fee (1 to 8) columns data.
    But the data should be inserted based product_type, service_type, lease_type columns values. (These 3 columns may contain upto 45 combinations).

  • How to insert parameter value into multiple columns and rows

    Hi All,
    I have one procedure insert_tab and I am passing
    100~101~102:103~104~105:106~107~108 as a parameter to that procedure. I wanted to insert each numeric value into one column. The output of the table should contain
    Table:
    Col1 Col2 Col3
    100 101 102
    103 104 105
    106 107 108
    Awaiting for your reply..

    That's not more clear for me...
    Anyway, if you really want a procedure for that, try :
    SQL> create table tblstr (col1 number,col2 number,col3 number);
    Table created.
    SQL>
    SQL> create or replace procedure insert_fct (p_string IN varchar2)
      2  as
      3  v_string     varchar2(4000):=p_string||':';
      4  v_substring  varchar2(4000);
      5 
      6  begin
      7      while instr(v_string,':') > 0 loop
      8            v_substring := substr(v_string,1,instr(v_string,':')-1)||'~';
      9            insert into tblstr(col1,col2,col3)
    10            values (substr(v_substring,1,instr(v_substring,'~',1,1)-1),
    11                    substr(v_substring,instr(v_substring,'~',1,1)+1,instr(v_substring,'~',1,2)-instr(v_substring,'~',1,1)-1),
    12                    substr(v_substring,instr(v_substring,'~',1,2)+1,instr(v_substring,'~',1,3)-instr(v_substring,'~',1,2)-1));
    13            v_string:=substr(v_string,instr(v_string,':')+1);
    14      end loop;
    15  end;
    16  /
    Procedure created.
    SQL>
    SQL> show err
    No errors.
    SQL>
    SQL> select * from tblstr;
    no rows selected
    SQL> exec insert_fct('100~101~102:103~104~105:106~107~108')
    PL/SQL procedure successfully completed.
    SQL> select * from tblstr;
          COL1       COL2       COL3
           100        101        102
           103        104        105
           106        107        108
    SQL> exec insert_fct('109~~')
    PL/SQL procedure successfully completed.
    SQL> exec insert_fct('~110~')
    PL/SQL procedure successfully completed.
    SQL> exec insert_fct('~~111')
    PL/SQL procedure successfully completed.
    SQL> select * from tblstr;
          COL1       COL2       COL3
           100        101        102
           103        104        105
           106        107        108
           109
                      110
                                 111
    6 rows selected.
    SQL> Nicolas.

  • How to insert an upper value into a column?

    Hi!,
    I need to insert an upper value into a column.
    The data is on a flat file and it could be lowercase or uppercase?
    Do I have to create a trigger to solve this problem?
    How could the trigger be?
    Thanks,
    Alex

    If you are using SQL*Loader to load the data from flat file into the db table, then you can achieve inserting the UPPER Case of column value in your sqlloader ctl file itself as in below example
    LOAD DATA
    INFILE *
    APPEND INTO TABLE XXX
    ( field1 position(1:7) char "UPPER(:field1)",
    field2 position(8:15) char "UPPER(:field2)"
    BEGINDATA
    Phil Locke
    Jason Durbin
    So in this case the Names Phil Locke and Jason Durbin will be inserted as PHIL LOCKE and JASON DURBIN into the target table.
    Regards,
    Murali Mohan

  • How to import column values into SharePoint 2013 Term Store Using Powershell(CSOM)

    Hi, 
    I do have SharePoint 2013 list with more than 500 items in it.Now I am trying to import column values into SharePoint 2013 Term Set A using Powershell scripts.
    I am new to Powershell(csom) and can anybody help me out to accomplish this task?
    Any help would be greately appreciated.
    Thank you,
    AA.
    AA.

    Hi
    check this doc
    http://wellytonian.com/2012/10/sharepoint-2010-2013-term-store-importer-using-csv/
    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

  • To display comma separted value into multiple column

    Hi,
    I want to display value into multiple column like below
    data is like this
    col1
    res_menaHome:MenaHome
    res_menaHomeEmp:MenaHome Employee
    res_MDSpecialSer:MD Special Services
    res_Smart:Smart
    now i want to display like
    col1 col2
    res_menaHome MenaHome
    res_menaHomeEmp MenaHome Employee
    res_MDSpecialSer MD Special Services
    res_Smart Smart
    Thanks in advance.

    You mean like this?
    with q as (select 'res_menaHome:MenaHome' myString from dual)
    select substr(myString, 1, instr(myString, ':') - 1) col1,
    substr(myString, instr(myString, ':') + 1) col2
    from q
    COL1,COL2
    res_menaHome,MenaHome

  • Combining Multiple occurrencesof the same field value into one and Sum prob

    Hi
    I am trying to combine the multiple occurrences of the field values and sum the amount to the target
    Source
    <Record>
    <Item>
    <Item1>1</item1>
    <item2>2</item2>
    <item3>3</item3>
    <item4>4</item4>
    <Amount1>5</Amount1>
    <Amount2>5</Amount2>
    </Item>
    <Item>
    <Item1>1</item1>
    <item2>2</item2>
    <item3>3</item3>
    <item4>4</item4>
    <Amount1>15</Amount1>
    <Amount2>15</Amount2>
    </Item>
    <Item>
    <Item1>1</item1>
    <item2>2</item2>
    <item3>3</item3>
    <item4>4</item4>
    <Amount1>5</Amount1>
    <Amount2>5</Amount2>
    </Item>
    </Record>
    Target
    <Record>
    <Item>
    <Item1>1</item1>
    <item2>2</item2>
    <item3>3</item3>
    <item4>4</item4>
    <Amount1>25</Amount1>
    <Amount2>25</Amount2>
    </Item>
    </Record>
    I am using MM at present. All fields are KeyFields here. Should check against each other.
    I followed Context setting to the Root Item and Sort, SplitByValue and CollapseContext to achieve the functionality.
    But it checks against each field and not all fields. So either one field has different value, only that perticular field gets into New Node and not the entire record. In this case, i might need UDF i guess. Any UDF help is much appreciated
    Bad Target example of what i am getting
    Source
    <Record>
    <Item>
    <Item1>1</item1>
    <item2>2</item2>
    <item3>3</item3>
    <item4>4</item4>
    <Amount1>5</Amount1>
    <Amount2>5</Amount2>
    </Item>
    <Item>
    <Item1>1</item1>
    <item2>2</item2>
    <item3>3</item3>
    <item4>4</item4>
    <Amount1>15</Amount1>
    <Amount2>15</Amount2>
    </Item>
    <Item>
    <Item1>2</item1>
    <item2>2</item2>
    <item3>3</item3>
    <item4>4</item4>
    <Amount1>5</Amount1>
    <Amount2>5</Amount2>
    </Item>
    </Record>
    Target
    <Record>
    <Item>
    <Item1>1</item1>
    <item2>2</item2>
    <item3>3</item3>
    <item4>4</item4>
    <Amount1>25</Amount1>
    <Amount2>25</Amount2>
    </Item>
    <Item>
    <Item1>2</Item1>
    </Item>
    </Record>
    In the above scneario, only Item1 returns the value into different node. But i like to have entire node values into the record, if one value changes in the entire record.
    Appreciate your help with the UDF in advance
    </Record>

    I think you are looking for string aggregation.
    The following are the replies posted by me in the forum recently on the same case.
    they might help you.
    Re: Concatenating multiple rows in a table - Very urgent - pls help
    Re: Doubt in a query ( Urgent )
    Re: How to remove words which consist of max 2 letters?
    Re: output like Name1,Name2,Name3...

  • How to use different default parameter value for different report subscriptions

    In ssrs is it possible to define different default parameter values for different subscriptions? In the following example I have a report which has two subscriptions with different start date and end date values:
    Report name – Testsubscription.rdl
    Subscription-1
    Input parameter (default values):
    start_date = first day of current Month
    end_date = till date
    Subscription-2
    Input parameter (default values):
    start_date = first day of current Quarter
    end_date = till date
    I know an alternative way of doing this would be to copy the rdl file with a different name but I am curious whether this can be done within a single report definition file. I am using SQL Server 2008 R2 Standard Edition.
    Thanks!
    spp

    Hi sppdba,
    As per my understanding, there is a report with two parameter: start_date and end_date, you want to configure subscription for the report, and set different default values for start date and end date. And you want to know if it is possible to achieve you
    goal by using a single report definition file.
    Since you are using SQL Server 2008 R2 Standard Edition, we need to achieve your goal by configuring two subscriptions for the report. For detail information, please refer to the following steps:
      1. In design surface, right click start_date and open Parameter Properties dialog box.
      2. In General pane, type Name and Prompt, set Data Type to Date/Time.
      3. Click Available Values in left pane, select Specify Values.
      4. Click Add button, in Label text box, type “First day of Current Month”, click (fx) button in Value section, then type the expression like below:
    =DateSerial(Year(Now()), Month(Now()), 1)
      5. Click Add button, in Label text box, type “First day of Current Quarter”, click (fx) button in Value section, then type the expression like below, then click OK.
    =DateSerial(Year(Now()), (3*DatePart("q",Now()))-2, 1)
      6. Right click end_date and open Parameter Properties dialog box.
      7. In Available Values pane, select Specify Values.
      8. Click Add button, in Label text box, type “Today”, click (fx) button in Value section, then type the expression =Today(), then click OK.
    Now that the parameters are created, we need to configure subscription for the report. For detail information, please follow these steps:
      1. Open Report Manager, and locate the report for which you want to create a new subscription.
      2. Hover over the report, and click the drop-down arrow.
      3. In the drop-down menu, click Manage. This opens the General properties page for the report.
      4. Select the Subscriptions tab, and then click New Subscription.
      5. Select the delivery extension and data source for the subscription.
      6. Select a method of delivery, then choose report delivery options.
      7. Specify conditions that cause the subscription to process and delivery to occur.
      8. Set start_date to First day of Current Month, end_date to Today, then click OK.
      9. Create a new subscription as step4 to 7, set start_date to First day of Current Quarter, end_date to Today, then click OK.
    The following screenshots are for your reference:
    For detail information about Creating Standard Subscriptions, please refer to the following document:
    http://msdn.microsoft.com/en-us/data/ms156307(v=sql.105)
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    If you have any feedback on our support, please click
    here.

  • Crystal Reports XI - How to pull same column value with different select...

    I have a report with many (around 30) sub reports and it is giving serious performance issue. I am currently finding out a strategy to improve the performance. I see that most of the sub reports are taking same parameters from main report except for one parameter which is different for each sub report and hard coded in them and pulling up the same column value from a oracle database with a different select criterion. I am trying to find out a way using either of command/crystal formula/SQL expression which can do the same job for me and give me performance improvement. I tried to take the parameters from the main report in one sub report and mapped them to parameters being transferred to the command and then drag and drop the field for which I need to display the value but due to some reason it is not returning values when I am trying multiple commands...I need some help in selecting a strategy for this issue resolution and some guidance....Any help would be highly appreciated....

    My version is 11.5.8.826. First of all I need to make it clear that I have 6 set of sub reports and each set has 5 sub reports. So if I can resolve the issue for one set, I resolve it for all. The sub reports are doing nothing but fetching a column value using a simple SQL SELECT query and appending to the right of a box in main report. The issue is that all these queries embedded into the sub reports are using same SQL except for one parameter in the "where" clause and they are fetching same column value from the database and fortunately all of them are returning same number of results. So at the end these results create a table when run. The only way I can stop using sub reports is by creating a table in the main report and use some object(formula/command/SQL expression or whatever) to fetch that column value using the same filter conditions. But please take a note that I need to use and append the same column value from a database table and use different filter conditions and append them to the right so that at the end they create a table...as long as I get the table in the output with a decent performance , anyone will be least bothered about what I used inside the report.....please ask me as many questions to get more lights on the issue....

  • Merging different values into one column

    Hi all,
    If my report has two columns A and B. For one value of A, there are multiple values coming from database for B.
    So, report displays them like this:
    A     B
    1     x
    1     y
    1     z
    Is it possible somehow that i can merge all possible values of B in one row instead of many. i.e. report should look like this:
    A     B
    1     x,y,z
    Please reply with your suggestions.

    Hi,
    It is possible that can merge all B column values in one row.
    Steps:-
    1. First you create an object for B using @aggregate_Aware() function like
    @Aggregate_Aware(TableName.B,TableName.B)+', '
    Object qualification should be measure. Here B is the column name.
    2. In WebI report drag and drop A and B objects
    3. Run the report
    Now you will get the result.
    Edited by: Swarna K on Mar 11, 2011 5:27 AM
    Edited by: Swarna K on Mar 11, 2011 7:20 AM

Maybe you are looking for