Using variables in ODI 11.1.1.5

Hi,
i have created 4 variables in ODI 11g as mentioned below:
1.Variable_name = v_date
datatype = alphanumeric
default value = '30-NOV-2011 11:00:00'
2.Variable_name = v_time_offset
datatype = alphanumeric
default value = 125
3.Variable_name = v_starttime
datatype = alphanumeric
default value = '30-NOV-2011 11:00:00'
4.Variable_name = v_endtime
datatype = alphanumeric
default value = '30-NOV-2011 11:30:00'
I have created a filter on the source table to pull the records only for the time between v_starttime and v_endtime.
Now, in the ODI package, I have declared all the above 4 variables. Here I want to calculate the variable values v_starttime and v_endtime to pass on to the interface. I have used the below calculations to set the variables :
v_starttime = #v_date+(#v_time_offset/1440)
v_endtime = #v_date+((#v_time_offset+5)/1440)
Now when I execute the package, the package(the interface) is getting failed with the error - invalid character. When I looked into the variables to see whether they are refreshed properly, they didn't. In the Operators, Under 'History' of variables section, the value of both the variables are showing as #v_date+(#v_time_offset/1440) and #v_date+((#v_time_offset+5)/1440) only. Thats means the varaibles are not evaluated properly. Kindly help me how can I fix this ? Many thanks in advance ...
regards,
sai

Hi Sai,
Please try below one
Take 2 more ODI variable 1) v_STime and 2) v_ETime
In v_STime write below query
select to_date(to_char(v_date,'yyyy-mm-dd'),'yyyy-mm-dd')+(to_number(#v_time_offset)/1440) from dual;
In v_ETime write below query
select to_date(to_char(v_date,'yyyy-mm-dd'),'yyyy-mm-dd')+(to_number(#v_time_offset)+5/1440) from dual;
Note: For v_date,v_starttime and v_endtime variable please don't take default value just write below query
Query: select sysdate from dual;
Hope this may helps you
Regards,
Phanikanth

Similar Messages

  • Difference Between 2 dates using variables in ODI

    Hi,
    I have 3 variables in ODI,
    Start Date, End Date and Duration.
    Start Date - Alphanumeric -  select TO_CHAR(SYSDATE,'DD-MM-YYYY HH24:MI:SS') FROM DUAL
    End Date - Alphanumeriic - select TO_CHAR(SYSDATE,'DD-MM-YYYY HH24:MI:SS') FROM DUAL
    Duration - Alphanumeric - select to_date(#Start_date, 'DD-MM-YYYY HH24:MI:SS') - to_date(#END_date, 'DD-MM-YYYY HH24:MI:SS') FROM DUAL
    It says invalid character.
    Please let me know how can I find the difference of the start date and end date as duration

    Have you tried
    select to_date('#Start_date', 'DD-MM-YYYY HH24:MI:SS') - to_date('#END_date', 'DD-MM-YYYY HH24:MI:SS') FROM DUAL
    Cheers
    John

  • Using Variables in ODI

    I am attempting to insert 20 years of data into our Data Warehouse using ODI.
    The Problem is that the query to retrieve the data takes upwards of 48+ hours. That is just the query running in a query tool.
    So what i would like to do is to run the query by quarters...
    ie: 1/1/1991 to 3/31/1991, 4/1/1991 to 6/30/1991, 7/1/1991 to 9/30/1991, 10/1/1991 to 12/31/1991, etc...
    I was attempting to create the begin and end dates as variable and use a loading package as my package to get the data into the warehouse.
    I set it up as the two beginning interfaces are Set Variables: my_start_date default value '10/1/1990' and my_end_date default value of '12/31/1990'.
    The 3rd and 4th are to be the incrementors, Refrech Variable:
    my_start_date Refreshing tab has a select query of : Select to_char(ADD_MONTHS(to_date(#my_start_date, 'MM/DD/YYYY'), 3), 'MM/DD/YYYY') from dual
    my_end_date Refreshing tab has a select query of : Select to_char(ADD_MONTHS(to_date(#my_end_date, 'MM/DD/YYYY'), 3), 'MM/DD/YYYY') from dual
    The 5th step is my ODI Interface with my source table (MY_SRC) that has a Filter of MY_SRC.TRANSACTION_DATE between to_date(#my_start_date, 'mm/dd/yyyy') and to_date(#my_end_date, 'mm/dd/yyyy')
    The last step is the Evaluate Variable to check to see if the my_start_date is greater than today.
    ~~~~~~~~~~~~~~~~~
    The problem i am getting is the 5th step fails with an error of:
    1843 : 22008 : java.sql.SQLException: ORA-01843: not a valid month
    ORA-02063: preceding line from #######
    Has anyone out there attempted to do this? I have been able to do this type of package with a single numeric variable, but i am having dificulties with the dates. Any ideas would be extremely helpful. Thanks.
    Tom Cusick
    Systems Programmer

    Ahh, ok now i see the Variables, looked right over them before.
    And I think i see the problem. My variables are being set to the correct date but as a date and not a string so when i am putting them into the filter it is not seeing the variable as a stirng and thus causing the problem.
    Ok so now i need to figure out how to make sure it is a string going to my interface and not a number.
    Thanks for pointing out where i can find the history information.

  • Using Variable in ODI

    Hi,
    I need to use a ODI varible in procedure. That is, when i execute a procedure the data from a oracle table should be stored in the ODI variable.
    Later i need to use the same variable in another procedure. But now how can i use the ODI variable in a procedure to store the oracle data.
    Some thing like this,
    declare
    begin
    select empno into #sud from emp_source where ename='Mohan';
    end;
    Here sud is the ODI variable i declared. i am getting some error here. so anyone who know please help me.
    Thanks in advance,
    Ram Mohan T.

    Hi Ram,
    You could not store the data to variable by procedure.
    Better way, write a sql quer for getting the value from the oracle table by:
    1) create a variable say var1
    2) Write a sql query in Refresh tab like( select empno from 'specify the schema properly' emp_source where ename='Mohan')
    3)Select the appropriate Logical schema in that
    4)validate the query by click right most top corner button
    5) after validation click refresh button inthat refresh tab.
    6)it execute the query and hold the values in history tab.
    Note: whatever query using in the variable sholud be returns a single value
    After refreshing the variable you can use it in some other procedure too
    Thanks,
    Madha.

  • How to Use Variables in ODI

    Hi,
    I am unable to pass the variable content to the filter i.e., the data is not getting constrained when variable is used in the filter.When the Variable is executed it is giving the correct value according to the query, but when it is passed to the filter, It is giving all the values regardless of the constraint.Can anybody suggest me the proper usage of variables.
    Thanks in advance..

    I believe you mean OBI instead of ODI. How are you referencing the variables in the filter? You need to reference them as @{variablename} in the filter.
    Thanks,
    Venkat
    http://oraclebizint.wordpress.com

  • Help : How to use list of values in Variable in ODI

    Dear All,
    I have a multiple values in table, and I would to use these values a a parameter in ODI to retrieve rows based on these values. As I know that we can use single value in variable in ODI.
    Any one can Help me please?

    Can't you use a join between the tables ?
    ODI mostly take advantage of native technologies.
    i.e If my source technology is oracle then i will create a join between the table i.e. MAINTABLE.column = LOVTABLE.COLUMN and also put a filter on LOVTABLE to take required values.
    OR you can write a subquery in the Filter i.e. MAINTABLE.COLUMN in ( Select LOVVALUES from LOVTABLE where LOVTABLE.ATTRIBUTE = 'BUSINESS_UNIT')

  • \Critical Use of variables in ODI

    Hi,
    I have a problem in which i have to use a filename which is dyanamic. so if my job is following:
    variable(containing dynamic name)--->interface
    everything runs fine
    but if
    variable(containing dynamic name)--->scenario of interface
    it doesnt works
    seems odi does not resolve variables in scenario
    Please suggest is it possible or not as i need to put a scenario and not the interface.

    I have put the value of the variable which i want to use in the input of scenario in the additional variables tab of scenario
    Project Variable Value
    General Filename #General.Filename
    General Filename
    I m getting this error:
    va.lang.Exception: Specified variable not found in the Repository : GENERAL.Filename
         at com.sunopsis.dwg.dbobj.SnpSession.updateVarWithSessVar(SnpSession.java:2905)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSessVariables(SnpSession.java:2466)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSessionPreTrt(SnpSession.java:2433)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1855)
    also current command is
    OdiStartScen "-SCEN_NAME=DYNAMICFILE" "-SCEN_VERSION=001" "-GENERAL.Filename=#General.Filename"
    I want to use variable from project general named as filename as an input to the scenario
    Please suggest me the correct way to do it.

  • 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

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

  • 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

  • How to get essbase substitution variable in ODI

    Hi All,
    I have a problem that I need to get the substitution variable from Essbase /EAS to work on some SQL statement in ODI.
    How can I do in ODI ???
    Thanks for all ..
    Thomas

    Hi,
    If you read my blog post :- http://john-goodwin.blogspot.com/2009/11/odi-series-planning-11113-enhancements.html
    In the post there is a section on retrieving essbase substitution variables and using them in ODI.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • 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

  • Variables at ODI 11.1.1.7 must be uppercase?

    Hi guys,
    Recently, I have upgrade ODI from 10g to 11.1.1.7 at the upgrade guide I saw that variables in ODI 11.1.1.5 must be in uppercase if they are not in this format I can use "".
    This apply to ODI 11.1.1.7?

    I believe it applies. Why dont you just test this in ODI 11.7?

  • Is it possible to read Essbase Substitution variables from ODI?

    Is it possible to read Essbase Substitution variables from ODI?

    Hi,
    You can do it with custom code, if you have a read of a blog I wrote :- http://john-goodwin.blogspot.com/2009/11/odi-series-planning-11113-enhancements.html
    About half way through I go into reading essbase sub vars using the essbase java API.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Changing substitution variables through ODI

    Hi John!
    We using ODI for loading data, before load we have to clear data.
    I have 2 questions regarding this issue:
    1. Can I change substitution variables through ODI
    2. Can I execute BR in Essbase.cmd
    Regards
    Sasha

    Hi,
    1. You can call maxl to update the substitution variables, either using the pre-maxl options in the KMs
    or you can execute an OS command through an ODI procedure
    2. I am not sure what you are asking, are you asking whether you can execute BRs through ODI, if so have a read of my last blog where I covered how to do it.
    You can execute BRs by using the command line launcher, have a read of the blog anyway because it goes through the command line launcher.
    Cheers
    John
    http://john-goodwin.blogspot.com/

Maybe you are looking for

  • Transfering music from an ipod to my computer

    ive had an ipod video for a year now. my friend lent me his ipod nano because i have a bunch of music on my computer that he wants on his ipod. the problem is i cant sync his ipod otherwise it will get rid of all the music that is on it already and r

  • Trying to create fillable secure form in Acrobat X

    I have Acrobat X Standard and I am trying to create a form that can be filled out then submitted but not printed or saved. When I set security and try to distribute it I get an error saying it can't distribute because of form security settings. I hav

  • Can RMAN restore TS with different name?

    Hi all, I have the RMAN TS backup (let's say 'HR') and am trying to restore it in the same database into different TS (let's say HR_TEST). However, I could use expdp (datapump) method, but since I have RMAN TS backup running daily, and would like to

  • Tween and motion help!

    Hi, So my problem is this.. I really want to create an animation where writing just appears as it is being written/drawn and leads on to draw the sketch of someones face and carries on. (hope you understand that) I know this must be done with tweens/

  • "user must change password at next logon" flag for multiple users

    2008 R2 domain with a couple of 2012 R2 DCs. john.user is in the Users OU. if I right-click john.user, choose properties, go to the account tab, and check "user must change password at next logon," the next time john.user tries to log in, he gets pro