ODI Variable using Variables

Does anyone know if it is possible to use a Variable inside of another variable??
first variable is Current_Sysdate which the query is:
Select sysdate
from dual
Second, I have a variable called Count_Rec: this is to count the records...
The SQL that drives this is:
Select count(r2.pn)
from register r2, pol p2
where p2.pdt =
(select max(p3.pdt)
from pol p3
where p3.pn = p2.pn and
p3.pdt = to_date('#Current_Sysdate', 'mm/dd/yyyy')) and
r2.pn = p2.pn and
r2.pdt = p2.pdt
when i test this in ODI i get an error:
Error while executing query
ORA-01858: a non-numeric character was found where a numeric was expected.
This is being caused by the "*** r3.pdt = to_date('#Current_Sysdate', 'mm/dd/yyyy')) and ***" line (I know this because if i remove this line it compiles completely)
My question is ... is it possible to use a variable within another variable in ODI??? if so does anyone have an idea what i am doing wrong here???
I realize i could just replace the #Current_Sysdate with sysdate but the idea is they may want to run this for a different date... it may not always be sysdate... so they wanted a variable in that spot...

DUplicate post

Similar Messages

  • ODI Procedure: Using Variable Logical Schema

    Hi!
    i wrote a PL\SQL procedure inside an odi procedure, using options, variables etc.
    now we need to execute the procedure in different logical schemas.
    We've at least 20 different logical schemas and to semplify the maintenance we'd like to pass the logical schema as an Option or something similar,
    is it possibile to do this with a procedure?
    The version of ODI is 11.1.1.5.0 and the targets are only Oracle DB.

    I've got a question : are all you schema in the same server (database) ?
    If so, you can LIST the schemas with a SQL Statement in the "command as SOURCE" tab.
    example :
    select owner as SCHEMA
    from all_tables
    where ...or a SQL Statement in ODI MASTER_Repository to get the logical schema :
    select lschema_name as SCHEMA
    from snp_lschema t1
    where ...And in the "command as destination" tab, you execute the PL SQL, but you use the result of SCHEMA.
    As a result, if you have 40 schema retrieved by the first SQL Statement, ODI will execut your PL/SQL statement 40 times, changing the SCHEMA value each time.
    And, in the first tab (command as destination), you use a generic Oracle User that have access to all schema of the dabase (or at least, the 40 schema you want).

  • Creating A Variable Using Variables

    I need to make a loop (which I know how to do) that needs to
    do this (which I have no clue how to do):
    Take arrayval and add the varaiable from the loop to make a
    variable name in which I can use to call them from flashvars
    i need something like

    I still am having this problem. If I set a flashvar
    arrayval=4 then they all come up as 4 instead of using:
    arrayval0=1&arrayval1=2arrayval2=5.
    Any help?

  • ODI Variable using SYSDATE - Issues comparing against EBS last_update_date

    Hello All,
    I followed the directions in the Oracle blog "Using Variables in ODI: The Timestamp Example". I created the variables and the package. My interface is trying to load incremental data from the source GL_JE_BATCHES table to my target table. I am comparing the last_update_date field in the GL_JE_BATCHES table to the LastUpdate variable. Using the standard variable build per the blog [Select sysdate from dual] I am receiving all kinds of errors. When I view the value in the variable I see 2009-12-23 [no quotes]. I have tried all kinds of to_char and to_date conversions on both the variable and the last_update_date fields. No matter what I've tried and Ican't make the variable work. Now I'm up against a deadline and I'm reaching out for some help! Hopefully someone else is working during the holidays!
    Thanks!
    Cheryl

    Thanks for taking the time to answer during the holidays!
    I am using an alphanumeric variable type. A few additional details:
    -- when I execute a query against the GL_JE_BATCHES table - WHERE last_update_date >= sysdate --- this query works
    -- same table - WHERE last_update_date = '10-Oct-2009' --- this query works
    -- same table - WHERE last_update_date = 10/10/2009 -- errors out with the 'expecting a date and received a number' error code.
    -- same table - WHERE last_update_date = 10-Oct-2009 -- errors out the 'DEC' is not a valid month.
    The list goes on and on. Seems like the only format, other than sysdate, that the source accepts = '10-Oct-2009'. So far I have not been able to get the variable to return that value. Using to_char I can get the variable 'value' to = 10-Oct-2009 but without the quotes.
    Your continued support and assistance is greatly appreciated!

  • How to assign a value to ODI Variable using ODI Procedure

    Hi ,
    Is it possible to assign a value to a ODI Variable using ODI Procedure ?
    If it is possible how we can do that.
    BEGIN
    IF #Counter=1
    Then
    #Next_Increment:=#Counter+1;
    End if;
    END;
    In my example I have 2 ODI Variables #counter and #Next_increment.
    I am trying to assign VALUE TO A ODI VARIABLE #next_increment from another ODI Variable #counter.
    thanks
    prasanna

    Prasanna,
    I have a similar requirement where I need to assign values to ODI variables within a procedure. How do we make use of an ODI package to accomplish this ?
    Actually, I have a sequence of ODI steps, and there is a call to a procedure 'LOG ERROR' from every step which gets called in case error occurs in any step. I just need to identify from which step the error came.
    Please help.

  • How to declare global variables using another global variable in ODI

    I am declaring a gloabal variable using another global variable.
    say for example:
    I have a global variable empid.
    I am decalaring another global variable empname in refreshing tab of global variables and the select statment is
    select empname from emp where empno = #GLOBAL.empid -------if i write like this i am getting error as invalid character.
    select empname from emp where empno = '#GLOBAL.empid'-------if i write like this i am getting error as invalid number.
    I have kept the datatype as numeric and action as non persistent
    Please help
    Thank you in advance.

    Hi,
    You cant test/refresh empname standalone.
    You need to create a new package drag and drop both variables and make them as refresh variable and execute that package and test.
    Flow,
    empid----> empname
    Thanks,
    Guru

  • How to use Variable in interface for Mapping in ODI 11g

    Hi,
    I want to use Variable 'Year' in interface mapping. how i can do that? I define a variable YEAR1 = '2001' and in interface i put #YEAR1 but it didn't work for me. is there any other way?
    Example.
    I m using 'Year' column in mapping and it is having different 3 constant values so i was think to define 3 variable Year1= '2001' & Year2= '2005' & Year3= '2010'.
    In interface i just want to put variable name insted giving fix value.
    regards
    Sher

    Thank u
    I m trying with all the options & when i create Variable i and set Default value to ''2001'
    '#YEAR'
    #YEAR
    '#PROJECT_NAME.YEAR'
    #PROJECT_NAM.YEAR
    #PROJECT_NAME.'YEAR'
    and setting to Stagging Area
    But still it is not working out.
    I m suing ODI11.1.1.3
    is it any issue?

  • Assign a value to an ODI or Java variable in a KM

    Hi Gurus,
    I'm developing a new KM and I need to get the name of a dblink by calling an Oracle function. How to store the result of a function in an ODI or Java variable in a KM step ?
    And if it is in an Java variable, how to use it in this kind of step (line 7) :
    create or replace view <%=odiRef.getObjectNameDefaultPSchema("L", "" , "W")%><%=odiRef.getInfo("COLL_NAME")%>
         <%=odiRef.getColList("", "[CX_COL_NAME]", ",\n\t", "", "")%>
    as select     <%=odiRef.getPop("DISTINCT_ROWS")%>
         <%=odiRef.getColList("", "[EXPRESSION]", ",\n\t", "", "")%>
    from     <%=odiRef.getSrcTablesList("", "[SCHEMA].[RES_NAME]@"+++*#PROJECT.VARIABLE*+++" [POP_TAB_ALIAS]", ", ", "")%>
    where     (1=1)
    <%=odiRef.getFilter()%>
    <%=odiRef.getJrnFilter()%>
    <%=odiRef.getJoin()%>
    <%=odiRef.getGrpBy()%>
    <%=odiRef.getHaving()%>
    Thanks a lot for your help.
    Best regards

    If it is java variable then your code should looks like this
    create or replace view <%=odiRef.getObjectNameDefaultPSchema("L", "" , "W")%><%=odiRef.getInfo("COLL_NAME")%>
    <%=odiRef.getColList("", "[CX_COL_NAME]", ",\n\t", "", "")%>
    as select     <%=odiRef.getPop("DISTINCT_ROWS")%>
    <%=odiRef.getColList("", "[EXPRESSION]", ",\n\t", "", "")%>
    from     <%=odiRef.getSrcTablesList("", "[SCHEMA].[RES_NAME]@ *<@=java_variable_name@>* [POP_TAB_ALIAS]", ", ", "")%>
    where     (1=1)
    <%=odiRef.getFilter()%>
    <%=odiRef.getJrnFilter()%>
    <%=odiRef.getJoin()%>
    <%=odiRef.getGrpBy()%>
    <%=odiRef.getHaving()%>
    If it is odi variable then your code should looks like this
    create or replace view <%=odiRef.getObjectNameDefaultPSchema("L", "" , "W")%><%=odiRef.getInfo("COLL_NAME")%>
    <%=odiRef.getColList("", "[CX_COL_NAME]", ",\n\t", "", "")%>
    as select     <%=odiRef.getPop("DISTINCT_ROWS")%>
    <%=odiRef.getColList("", "[EXPRESSION]", ",\n\t", "", "")%>
    from     <%=odiRef.getSrcTablesList("", "[SCHEMA].[RES_NAME]@ *#odi_variable_name* [POP_TAB_ALIAS]", ", ", "")%>
    where     (1=1)
    <%=odiRef.getFilter()%>
    <%=odiRef.getJrnFilter()%>
    <%=odiRef.getJoin()%>
    <%=odiRef.getGrpBy()%>
    <%=odiRef.getHaving()%>

  • Dynamically creating file using variable

    HI, i am facing an issue in creating file on run time using variable.
    i have a variable FileName. In refresh tab i have written a query like SELECT TO_CHAR(SYSDATE,'YYYY,MM,DD') || 'TEST' FROM DUAL. i tested the variable and its value is correct.
    i have created an interface to extract the data from table and store it in file. i have assigned variable FileName to the file.
    Now when i run the interface...the file is created but the header is created in different file and its name is ambiguous e,g(19) and the data is placed in other file with the name which is the value of variable FileName.....
    ISSUE is two ODI creates two files one for header only and other for data....
    when i run my interface in a package the file created perfectly ..... but i dun want to use package i want to create file through running interface only

    one file name is some number like 19.txt and other filename is 20121211_TEST.txt (this name is coming from variable).....
    however when i create a package with variable and interface,only one file is created 20121211_TEST.txt (header and data are not created in separate files.)
    create header     (ID,
         NAME,
         DEPT)
    /*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=TARGET_FILESNP$CRLOAD_FILE=*E:\tempProj/19*SNP$CRFILE_FORMAT=DSNP$CRFILE_SEP_FIELD=0x007eSNP$CRFILE_SEP_LINE=0x000D0x000ASNP$CRFILE_FIRST_ROW=0SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=IDSNP$CRTYPE_NAME=STRINGSNP$CRORDER=1SNP$CRLINE_OFFSET=1SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=NAMESNP$CRTYPE_NAME=STRINGSNP$CRORDER=2SNP$CRLINE_OFFSET=51SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=DEPTSNP$CRTYPE_NAME=STRINGSNP$CRORDER=3SNP$CRLINE_OFFSET=101SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CR$$SNPS_END_KEY*/
    Edited by: 975356 on Dec 11, 2012 10:57 PM
    Edited by: 975356 on Dec 11, 2012 10:58 PM

  • Using variables in Topology

    Hi All,
    In ODI do we use variables in topology as well?
    If so , 1) for which scenarios we use it 2) how we can implement that?
    Please explain with examples.
    Thanks,
    Pankaj Kabdal

    Lets take a fictitious scenario where more than 6 environments are there. Your codes needs to be passed trough all of them and the user for the same table in each env is different. Also after deploying your code in prod there are chances that the user might change for the target table but not the password. In that scenario the Admin guy needs to manually update the data server every time user get changed.
    Instead logging into ODI you can configure a table which will store the username. So what you can do is to read this table to fetch the username and substitute it in dataserver via odi variable.
    select username from user_config where context='<%=odiRef.getContext( "CTX_Name" )%>'
    Thats it

  • Encoding variable using agent

    Hi guys!
    I'm trying to encode a password(in variable) using agent.s. My commands looks like this:
    ./agent.sh encode #VARIABLEAnd all i get is 255: Wrong process code...
    Why is that?
    Please help ODI gurus.
    Regards,
    PsmakR

    I'm not sure that you need to encrypt the SFTP password to use OdiSftpGet.
    definition of the parameter "Remote user password" is :
    The password of the Remote User OR the passphrase of the password protected identity file provided in the -IDENTITY_FILE argument. If the -IDENTITY_FILE argument is provided, this value will be used as the passphrase for the password protected identity file. If the public key authentication fails it will fall back to the user password authentication
    But this time I think that in this parameter you can put a variable.
    You should try to affect in the variable your sftp password in clear (without encryption).
    Brice

  • Error-Receiver File Adapter using Variable substitution when file is empty

    XI Experts,
    We are on PI 7.0, SP14.
    We are using variable subtitution to get the filename from source message. This works fine as long as we have data in the payload for filename element. But we have a scenario where we don't have to create file when certain condition does not exists in source message so in the message payload filename element will not exists in such condition and file will be empty and we should not create file.
    Parameter in the communication channel for Handling empty message is "Ignore".
    Does anyone knows how to handle this scneario. We don't want to default any file name in the message mapping if source file name element does not exists.
    We are following getting error in the Adapter engine.
    MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: file: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: file
    Thanks
    MP

    You can implement this by writing the module to throw an exception or whatever method you want to execute.
    If you don't want to receive an error message then module is suitable for you.
    Gaurav Jain

  • Why do text variables using Running Header character style translate forced returns as a word space in the running head on the first page but close up the space on subsequent pages?

    In an InDesign document that requires 3 different Chapter head paragraph styles (to cope with differrent length headings) I've set up the running heads on the master page with a text variable using the Running header (character style) option. The character style I've assigned to this is an empty character style that is applied to all 3 chapter head paragraph styles.
    Some chapter heads require a forced line break, so that the line breaks are aethesically pleasing. On the first page the text variable translates this forced line break as a word space in the running head, but on subsequent pages it ignores the forced line break. This means that if you have a word space before the forced line break, on the first page you get a double word space and on subsequent pages the running head sets correctly with a single word space. But if you remove the word space before the forced line break in the chapter head text, the first running head sets correctly with forced line break interpreted as a single word space, but on subsequest pages the space is closed up.
    This only seems to be a problem when the character style option is used for header text variables. If a paragraph style is used the forrced line break is interpreted as a a single word space in all instances, both on the foirst page and subsequent pages.
    This would appear to be a bug in how text variables are applied when using the Running header (character style) option. I can't see any other reason why the text variable would beheave differently on the first page and on subsequent pages. There is only one master page, so it isn't a case of their being an error between a main master page and a chapter opener master page.
    Does anyone have any solutionss, or know if this problem has been fixed in subsequent releases of InDesign (I'm using CS6 ID version 8.0)
    Thanks

    Ask in the ID forum...
    Mylenium

  • Control global variable used in sub vi

    Hi,
    I've created a vi to read an instrument and to initiate its calibration with labview. This VI stores data in a global variable containing measurments and status of the instrument.
    Now what I'm trying to do is create a sub vi with this to read&write 2 exactly identical instruments so I can finally create a VI that read all 3 instruments simultaneously.
    How could I create a control on the global variable used by the sub VIs since it is the only thing that will change along with its COM port ?
    I included a screetshot of the current VI.
    Thanks,
    Attachments:
    Read_Calibrate.PNG ‏61 KB

    I would make an array of values and then you just pass in which value to update.  I would actually take it a step further and make an Action Engine that can update the data and return the data.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Formula variable using Replacement path not working

    Dear All,
    I am using a query to calculate YTD values in the report. I am using a formula variable to calculate the number of months. Formula is
    Month To - Month From+1
    When I am giving the range from 001 to 006 for period in th evariable screen,
    I am gettung Month To as 6 and Month From as 6 with total no . of months as 1.
    I think Month From is not being caculated properly. I created another formul variable using Replacement path, for characteristic Posting period, replace with a Key and dimension ID as number with out any offset.
    Still not working.
    Any suggestions.
    Thanks and Regards,
    Srini
    Edited by: Srinivas on Apr 24, 2008 11:13 AM

    Hello,
    I have seen this document already. It is slightly different from what I am trying to do here than what the post shows. How ever,  I did everything right, atleast seems to be and don´t know why I am not getting the From value from the posting period selected. To value variable is coming right.
    Any more sugegstions.?
    Thanks and Regards,
    Srini

Maybe you are looking for