Union in ODI using KM

Hi,
I am trying to do union between 2 tables in ODI. It worked the following ways :-
1) By writing two interfaces and writing package on it.
2) Writing view on the tables in the database & then using this as a source in the interface
But I could not get the third way i.e. using KM. How do i do union between tables using LKM? I tried modifying the LKM SQL to SQL, but that did not work..

my need was to create an union like that:
insert into TRG_table (TRGC1,TRGC2,TRGC3)
select SRC1C1,SRC1C2,SRC1C3
from SRC1
union
select SRC2C1,SRC2C2,SRC2C3+SRC2C4
from SRC2
etc...
I created one temporary interface for each select with a particular KM that create a view...
each temporary interface must have the same column as my TRG_TABLE: TRGC1,TRGC2,TRGC3
the IKM has just one step with the code
create view <%=odiRef.getTable("L","TARG_NAME","A")%>
     <%=odiRef.getColList("", "[COL_NAME]", ",\n\t", "", "((INS and !TRG) and REW)")%>
select <%=odiRef.getPop("DISTINCT_ROWS")%>
     <%=odiRef.getColList("", "[EXPRESSION]", ",\n\t", "", "((INS and !TRG) and REW)")%>
from      <%=odiRef.getFrom()%>
where     <% if (odiRef.getPop("HAS_JRN").equals("0")) { %>
     (1=1)
     <%} else {%>
     JRN_FLAG <> 'D'
     <% } %>
<%=odiRef.getJoin()%>
<%=odiRef.getFilter()%>
<%=odiRef.getJrnFilter()%>
... I have 3 tempraries interfaces:
TSRC1, TSRC2, TSRC3 with the same column... each of them generated as a view
After that i created an interface with the 3 temporaries interfaces in source and i created a specifique IKM to do the union
like that:
insert into <%=odiRef.getTable("L","TARG_NAME","A")%>
     <%=odiRef.getColList("", "[COL_NAME]", ",\n\t", "", "((INS and !TRG) and REW)")%>
select <%=odiRef.getColList("", "[COL_NAME]", ",\n\t", "", "((INS and !TRG) and REW)")%> from <%=odiRef.getTable("L","TARG_NAME","A")%>
where 1=2
<%=odiRef.getSrcTablesList("", " \nunion select * from [WORK_SCHEMA].[TABLE_NAME]", "", "")%>
the generated code was
insert into TRG_table (TRGC1,TRGC2,TRGC3)
select TRGC1,TRGC2,TRGC3 from TRG_table where 1=2
union select TRGC1,TRGC2,TRGC3 from TSRC1
union select TRGC1,TRGC2,TRGC3 from TSRC2
union select TRGC1,TRGC2,TRGC3 from TSRC3

Similar Messages

  • Can ODI use environment variables?

    Running on Linux/Unix, can ODI use environment variables? For example, export LANGUAGE="en", and anyway in ODI can get variable LANGUAGE?

    It is easy.
    Use the following command at variable Refresh tab and let the Logical Schema to the file too...
    Just change the file path (c:/temp/cezar_test.txt)
    Select COLUMN_1 from TEST
    /*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=TESTSNP$CRLOAD_FILE=c:/temp/cezar_test.txtSNP$CRFILE_FORMAT=DSNP$CRFILE_SEP_FIELD=3BSNP$CRFILE_SEP_LINE=0D0ASNP$CRFILE_FIRST_ROW=0SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=COLUMN_1SNP$CRTYPE_NAME=STRINGSNP$CRORDER=1SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CR$$SNPS_END_KEY*/
    For this command the file must to have just just the value in one line.
    Does it help you?
    Edited by: Cezar Santos on 23/01/2009 16:14

  • How cud I run odi using a java application.

    HI,
    I need the location of the jar files that cud help me to run odi using a java application.
    I am unable to find jar file which is responsible for the invoking ODI using the classes in the package named
    "oracle.odi.sdk.invocation".
    I found this package name from doc
    regards,
    Palash Chatterjee

    It's going to depend on the application in question.

  • How to create Union Time Pool using accruals ???

    Hi,
    My client has a unique requirement of creating a Union Time Pool i.e. at the begining of each year the client will have 'X' amount of hours assigned to the pool. Employees under Union Contract will then be eligible to take any leave hours from that time pool as long as they are approved by there supervisor. Now, if we create an element pertaining to the special leave based on Time Pool, then an entry can be made at timecard level and the number of hours remaining can be determined.
    But, this pool is not employee based hence the Hours remaining calculation for the Time Pool is irrespective of any assignment rather its organization/GRE based. How do we implement this using Accruals?
    The client wants to view the balances in the Time Pool within the system. How can that be achieved?
    I understand Accruals Caculation and balances is totally assignment based, how can that be made for GRE/Organization based?
    Any help or suggestions will be highly appreciated.
    Thanks,
    Ujjal

    Hi,
    This is a really interesting scenario.. what are you trying to do
    1. Find a place where the common pool details can be entered at the start of the year
    2. The accrual process should deduct from this pool
    3. On accrual balance for the union should be displayed.
    let us evaluate what are things that cannot be used
    1. Elements can be initialized as the leave pool is for a group of people whereas elements are for an assignment
    2. Balances cannot be used for same reason
    so what are the options that we have..
    1. Store the pool in a lookup that can be created based on a bg or gre (use dff) and use the date fields of the lookup to simulate date track feature in HRMS. This way you would be able to enter values for every year for every bg / gre. Also enable another dff segment to store the balance leave in the pool. This field can be hidden.
    2. You can refer lookup in the accrual rules and evaluate the pool for processing the leave
    3. Customize the form / page to display the remaining pool from based on the person's detail and the lookup. This customization could be complicated instead you can maintain a dff in person/ asg table and write a custom process that will populate the pool balance for all people.
    This one of the suggestion I can give you.. there could be other options that you can evaluate.. but its not going to be simple..
    I hope this helps you.
    Regards,
    Vikash

  • Union Of reports using Combine Similar Request

    Hi,
    I have a requirements to perform a calculation that involves results from 4 different reports.
    I am using the Union Operation in Combine Similar request for analysis option and I built the table that pulls out values from 4 different reports. Now the business requirement requires that I sum the results of 3 of these reports and subtract the result of the 4th report from the sum. Is there a way to achieve this additional calculation.
    To put this in an example
    Report 1 Results + Report 2 Results + Report 3 Results - (report 4 results)
    I made sure that all the columns in these reports match in terms of datatypes to perform the union operation on these 4 reports.
    One addition, I do not have an option to extract this data just in one report due to differences in the filters and also these are sources from multiple fact tables.
    Please help me with this request. If there are any portions of this message on which you need more clarification please let me know.
    Any help will be greatly appreciated.

    Instead of combining those 4 different criteria I would suggest to go by metric level filters or and then do the final calculation or else 'Filter based on results of another request'.
    Pls mark if helps

  • ODI: Using Date in Variable - Suggestion

    Hi,
    I have created a refresh variable - DAY with following code:
    Select TO_CHAR(sysdate,'MM/DD/YYYY') from dual
    Variable datatype - Alphanumeric
    Now I am using the siame variable as evaluate variable in a package.
    The Evaluation condition is also the same - Select TO_CHAR(sysdate,'MM/DD/YYYY') from dual
    However, the ODI is not evaluating the condition properly and always returns false.
    Any guidelines where i am going wrong.

    Hi
    Please try below select query in both refresh and evaluate variables, for date variable hope you provided Logical Schema in date variable
    SELECT '<%=odiRef.getSysDate( )%>' FROM dual
    In Refresh variable:
    pass above select query
    place same variable in pkg with variable type Evaluate
    In Evaluate variable:
    by default above select query will available in Refreshing tab and in Evaluate variable property give Operator as = and Value as above select query.
    This will work
    Regards,
    Phanikanth

  • ODI Using Axis2 Passing Multiple Variables

    Hi,
    We are using Axis2 in between a .Net web app to pass four parameters to an ODI scenario. I am using SOAPUI to remove the web app from the testing process. Everything is working well except for the fact that only the last variable in the XML is ever read and stored in the ODI scenario execution. Below is a sample of our XML variable setup. In the ODI scenario we declare each of the four variables in the first four steps of the package (which I read somewhere was the proper setup). Regardless, if I remove the last two variable in the XML then only the second variable "v_HFMI_Fiscal_Year" is stored properly and the first is ignored. Furthermore, if I remove the last variable then the third is stored properly and the first two are ignored. Can anyone help?
    <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:odi="xmlns.oracle.com/odi/OdiInvoke/">
    <soapenv:Header/>
    <soapenv:Body>
    <odi:invokeScenarioRequest>
    <odi:Variables>
    <odi:Name>HFMI_PROJECT.v_HFMI_UserID</odi:Name>
    <odi:Value>CORMSBY</odi:Value>
    <odi:Name>HFMI_PROJECT.v_HFMI_Fiscal_Year</odi:Name>
    <odi:Value>2008</odi:Value>
    <odi:Name>HFMI_PROJECT.v_HFMI_Fiscal_Period</odi:Name>
    <odi:Value>06</odi:Value>
    <odi:Name>HFMI_PROJECT.v_HFMI_Submission_Type</odi:Name>
    <odi:Value>BPY2</odi:Value>
    </odi:Variables>
    </odi:Command>
    </odi:invokeScenarioRequest>
    </soapenv:Body>
    </soapenv:Envelope>

    Rhian80 wrote:
    I would use Applescript to do everything but I'm the only Apple person on staff and if I get hit by a beer truck tomorrow, someone has to know how to do this stuff. I figure they have better odds of finding someone on staff who knows UNIX.
    Another option may be to write the whole thing as a shell script and use Pashua or Platypus to create a GUI around it.
    One warning about creating and running shell scripts from AppleScript: make sure you correctly escape any user-supplied values when assembling the shell script. The easiest way to do this is by using the text object's 'quoted form' property, like this:
    do shell script "/Users/labadmin/Desktop/labbuild.sh " & quoted form of RoomNumber & space & quoted form of StationNumber
    or, if your shell script expects the room and station numbers to be supplied as a single argument rather than two separate ones:
    do shell script "/Users/labadmin/Desktop/labbuild.sh " & quoted form of (RoomNumber & StationNumber)
    If you forget to do this, Very Bad Things can easily happen when the inputted text contains spaces or other 'special' characters, either by accident or intent, e.g.:
    set user_input to "; say Oops;"
    do shell script "echo My name is " & user_input
    Do a web search for 'injection attack' for more on the perils of failing to sanitize your inputs properly.
    Incidentally, the latest edition of Apress's Learn AppleScript, which I co-wrote, has an entire chapter devoted to combining AppleScript and Unix shell scripting, if you're new to this subject./self-plug

  • Why UNION would not  use hash unique

    When issue a query like 'select distinct ....'
    it will use hash unique instead of sort unique on oracle database version 10gr2 or higher.
    Is it possible that UNION operations use a hash unique to eliminate duplicate rows?
    Thanks.

    NathanielNie wrote:
    When issue a query like 'select distinct ....'
    it will use hash unique instead of sort unique on oracle database version 10gr2 or higher.
    Is it possible that UNION operations use a hash unique to eliminate duplicate rows?
    Thanks.are you applying for a job to improve the CBO's behavior?

  • ODI: Use of Java BeanShell in Knowlegde Module

    Hello,
    I have an array defined pkCols in earlier steps of my IKM. It has assigned 4 values ('A', 'B','C','D').
    I would like to parse all values into one string so I could save them during INSERT INTO ... SELECT statement.
    Basically I would like to get a string 'A_B_C_D_' from my pkCols array.
    So - I have created a step within SQL technology that looks like this:
    INSERT INTO audit_table (...)
    SELECT
    col1, col2, col3,
    '<@ for (i=0; i<pkCols.size(); i++); { @><@=pkCols.get(i)@>_<@ } @>*'* as col4, col5
    FROM other_audited_table;
    It works, but when I look into audit_table in col4 i see exacly the string:
    <@ for (i=0; i<pkCols.size(); i++); { @><@=pkCols.get(i)@>_<@ } @>
    and not string that I am expecting (A_B_C_D_)
    What should I do to make it work and what mechanism I am not aware of ?
    regards,
    J.

    Hi,
    side and saving this work in
    a flat file (java property file/xml file) at the
    server side.
    Could n e 1 suggest me that saving flat file at the
    server side would work,
    coz this file would share by multiple clients.And how
    locking facility j2e gives whilesomebody is modifing
    one file.Does "server side" mean EJBs? Is so, from the EJB 2.1 specs document, section 25.1.2 :
    "An enterprise bean must not use the java.io package to attempt to access files and directories in the file system.
    The file system APIs are not well-suited for business components to access data. Business components should use a resource manager API, such as JDBC, to store data."
    Just make sure you use a resource manager to access files.
    Kexkey

  • ODI: Using Table Name in Dynamic filters

    We have a requirement, where the filters have to be dynamically generated and applied on the source system data stores.
    The requirement can be best explained by the below example.
    I have EMPLOYEE and DEPARTMENT table as the source datastores and EMP_DEPT (flat table) as the target datastore.
    The filter condition will be updated now and then by the admin in a table. They would like to run the integration interface with the condition mentioned in the table.
    Metadata table and sample data: (DY_FILTERS)
    TABLE_NAME | INTERFACE_NAME | CONDITION
    EMPLOYEE | EMP_DEPT | EMPLOYEE.EMPLOYEE_NAME LIKE 'A%'
    DEPARTMENT | EMP_DEPT | DEPARTMENT.DEPARTMENT_ID = 10
    So now the interface has to run with the conditions 'EMPLOYEE.EMPLOYEE_NAME LIKE 'A%' and DEPARTMENT.DEPARTMENT_ID = 10.
    To achieve, the best possible solution I can think of is, I have defined a variable for the dynamic filter and under the refresh section and I am planning to use the following query:
    SELECT CONDITION FROM DY_FILTERS WHERE INTERFACE_NAME = <%=odiRef.getPop("POP_NAME")%> AND
    TABLE_NAME = ***************.
    I was able to pick the interface that is currently involved by using getPop() method where as I dont have clue for getting the table name.
    Please share with me, if you have answer. Also if you have any other way to achieve this, please share the same.
    Note: The actual scenario is more complex than the example given above. But the crux of the requirement is very well covered in the example.
    Edited by: 986046 on Feb 14, 2013 2:06 PM

    Hi,
    If you've only one source datastore in your interface, you can retrieve it's name with <%=odiRef.getSrcTablesList("[RES_NAME]", "")%>.
    If you have more than one source it will list all you sources.
    However I can't see when you plan to refresh your variable. getSrcTablesList won't work before/after the interface execution.
    Regards,
    JeromeFr

  • Sending attachment in ODI using odisendmail

    Hi,
    Need assistance.
    I have one maxl which loads data into Hyperion and generates error file say 'kickouts.err' in particual path. And we are sending mail to users with attachment of that .err file which was generated during the data load.
    Problem is: whenever kickouts are there, ODI picks up the .err file in the specified path and send it to users, which is fine. But when there are no kick outs, .err file does not get generated and in send mail step ODI is picking the old .err file in the specified path and sending as attachment.
    Pls let me know what are the possible solutions to prevent this?
    Thanks in advance!
    Regards,
    VNK

    968457 wrote:
    Hi,
    Need assistance.
    I have one maxl which loads data into Hyperion and generates error file say 'kickouts.err' in particual path. And we are sending mail to users with attachment of that .err file which was generated during the data load.
    You can rename the error file with nane like 'kickouts.err_date' in the initial sets of your package.
    If the kickouts are there then it will generate new 'kickouts.err' error file and send it across
    If th kickouts are not there then .err file does not get generated and in send mail step ODI will not find any .err file to send as attachment.
    Problem is: whenever kickouts are there, ODI picks up the .err file in the specified path and send it to users, which is fine. But when there are no kick outs, .err file does not get generated and in send mail step ODI is picking the old .err file in the specified path and sending as attachment.
    Pls let me know what are the possible solutions to prevent this?
    Thanks in advance!
    Regards,
    VNK

  • Error in ODI  ,using source EBS and target  planning

    Hi,
    I am in FDM ERPI integrator,source is EBS and target is Planning ,I didn't get the data from source and I got this below error,
    Execution error :
    java.lang.Exception :the scenario did not end properly.
    at.java.lang.Thread.run(Unknown Source)
    pls help me on this situation.
    regards,
    SV

    Hi There,
    I am trying to extract metadata out of EBS and target is Essbase. Everything is setup and connection working fine.
    My problem is that the chart of accounts is getting built in Essbase as a flat structure? How do I get the roll ups from EBS into Essbase? Is there a certain seeting that I must choose to be able to build the Parent Child relationships?
    Thanks for the help
    Regards
    Henk

  • Union ODI 11G

    Hi All,
    I am trying to implement Union operation in ODI using the below link
    http://odiexperts.com/11g-oracle-data-integrator-part-611g-union-minus-intersect/
    When i execute the interface after creating two datasets, i dont see the union operation in the operator.
    Operator code :
    insert into     XXXX..ASHOK_STG12_CONTENT
         CONTENT_ID,
         PROGRAM_ID,
         EPISODE_ID,
         TELECAST_ID,
         START_DATE,
         END_DATE
    select     
         STG1CONTENT.CONTENT_ID,
         STG1CONTENT.PROGRAM_ID,
         STG1CONTENT.EPISODE_ID,
         STG1CONTENT.TELECAST_ID,
         STG1CONTENT.START_DATE,
         STG1CONTENT.END_DATE
    from     XXXX..ASHOK_STG2_CONTENT AS STG2CONTENT
    where     
         (1=1)
    It is fetching the values from dataset 1 but the table name from dataset 2.
    Expected code:
    insert into     XXXX..ASHOK_STG12_CONTENT
         CONTENT_ID,
         PROGRAM_ID,
         EPISODE_ID,
         TELECAST_ID,
         START_DATE,
         END_DATE
    select     
         STG1CONTENT.CONTENT_ID,
         STG1CONTENT.PROGRAM_ID,
         STG1CONTENT.EPISODE_ID,
         STG1CONTENT.TELECAST_ID,
         STG1CONTENT.START_DATE,
         STG1CONTENT.END_DATE
    from     XXXX..ASHOK_STG1_CONTENT AS STG1CONTENT
    union
    select     
         STG2CONTENT.CONTENT_ID,
         STG2CONTENT.PROGRAM_ID,
         STG2CONTENT.EPISODE_ID,
         STG2CONTENT.TELECAST_ID,
         STG2CONTENT.START_DATE,
         STG2CONTENT.END_DATE
    from     XXXX..ASHOK_STG2_CONTENT AS STG1CONTENT
    Can some one pls take a look?
    Thanks,
    Ashok

    Here is the generated code for me
    insert into     SCOTT.I$_EMP_LKUP
         EMPNO,
         ENAME,
         JOB,
         MGR,
         HIREDATE,
         SAL,
         COMM,
         DEPTNO
    select      
         EMP_SCD.EMPNO,
         EMP_SCD.ENAME,
         EMP_SCD.JOB,
         EMP_SCD.MGR,
         EMP_SCD.HIREDATE,
         EMP_SCD.SAL,
         EMP_SCD.COMM,
         EMP_SCD.DEPTNO
    from     SCOTT.EMP_SCD EMP_SCD
    where     
         (1=1)
    UNION
    select      
         EMP.EMPNO,
         EMP.ENAME,
         EMP.JOB,
         EMP.MGR,
         EMP.HIREDATE,
         EMP.SAL,
         EMP.COMM,
         EMP.DEPTNO
    from     SCOTT.EMP EMP
    where     
         (1=1)
    Better you recreate the interface again.

  • How to call webservice for each record in a table using ODI

    Hi
    I am new to ODI and Webservice. I want to invoke a scenario in ODI using web service. I hava a weblogic application server with axis 2 deployed.
    But I want call webservice for each record in a table
    For eg: "EMP" table have 50 records, for each record web service should invoke
    Can any one help me on it.
    Thanks,
    phani
    Edited by: user12774166 on Jun 6, 2010 11:16 PM

    If your goal is "call" a web service, Jason's Straub's [flex-ws-api|https://flex-ws-api.samplecode.oracle.com/] is by far the best I've seen. You might want read more about it on [his blog|http://jastraub.blogspot.com/search?q=+flex_ws_api+].
    Tyler Muth
    http://tylermuth.wordpress.com
    [Applied Oracle Security: Developing Secure Database and Middleware Environments|http://sn.im/aos.book]

  • Use of UNION in SQL

    Hi,
    I am using Oracle JDeveloper 11 g (11.1.1.3.0) and am in the process of designing a Database. I was going to use Oracle Express which seems to indicate that it supports UNION in SQL. However, the JDeveloper tells me that while my SQL syntax is valid when I include 'union' statements, the use of 'union' is not supported. Can I ignore the JDeveloper warning or is there some other way of getting around this? Also, am I right in thinking that Oracle Express supports UNION?
    Thanks for any help,
    Jim

    Hi,
    Oracle XE does support UNION. Not sure why JDeveloper gives you a warning and you don't provide steps to reproduce
    Frank

Maybe you are looking for

  • Capture refernce PO number in BADI ME_GUI_PO_CUST

    Hello all, I am workinmng on purchase order screen enhancement Using BADI ME_GUI_PO_CUST new custom fields are implemented and it is working fine. when i create new PO using reference PO ( dragging from document overview), need ot capture the referen

  • How to Get Input From User and Display Result

    Hi , I need to get 2 inputs from user and to display it's Mutilple Value. The Below Code is working fine to get 2 Input's from user,but it display a Junk value as a Result .How to overcome this Problem. I need to display it's Mutilple(a*b) value of "

  • Call For Papers - Session Proposals

    Call for Session Proposals Open Until December 17 The time has come to begin accepting and reviewing session proposals for BrainShare 2011 in Salt Lake City. The Call for Papers (CFP) will be open from now through December 17, 2010 (5:00 PM MST). If

  • Not able to view the custom taskflows in Oracle Webcenter 11g PS3 catalogue

    Hi, I have created one custom taskflow and followed the below steps to view custom task flow in webcenter ps3 catalogue (i.e. make task flow available under Mash-Ups\task flow at run time) 1)right click custom task flow and added to project. 2)rigth

  • Resource for JSF 2.2

    Hi, I am doing a POC on JSF 2.2 . I read the Blog from Arun Gupta which is great . Can I have more resources on the subject. Thanks