Substitution variable in sql load rules file

Okay gurus,
I need a little guidance, I have to replace the value of 201020 and 2008 from substitution variables. I have created the variables and set them up globally on the essbase server.
201020 = FW00
2008 = FY00
WHERE ACT.FISCAL_WEEK_ID <= 201020
AND ACT.FISCAL_YEAR_ID > 2008
AND RTDIV.DIV IN (1,2,3,4,5,6,7,8,9,99) (This is the query with hard coded values of week and year)
When i m trying to put sub variables there , its throwing the error. please find below the way i was trying to do it.
WHERE ACT.FISCAL_WEEK_ID = '&FW00'
AND ACT.FISCAL_YEAR_ID = '&FY00'
But unfortunately, its throwing error Error: 1021001 Failed to Establish Connection With SQL Database Server. See log for more information
I know that this is the generic error because if i put the hard coded value in sql load rules it works fine.
Is it the right way to out sub var in sql load rules???
Please advice and thanks in advance.

Hi Genn,
I tried to see the app log for sql but i m afraid that there is nothing in there, the only error message which I am getting in app log is this:
Failed to Establish Connection With SQL Database Server. See log for more information
Its an ASO cube and initially i was using the variable as FY00 AS "2008" it did not work and than i tried without quotes in variable but is still not working.
Any idea..thanks in advance.

Similar Messages

  • Substitution Variables in Essbase Load Rules File

    Hi,
    Has anyone tried using substitution variables in Load Rules File Header definition?
    I need to load data based on the Year & I have different Files for 3 Years- CurYr, BudYr1 & BudYr2. Is it allowed to specify the Year Substitution variable in the Rule File Header? I am getting an error while loading.
    Appreciate your thoughts.
    Thanks,
    -Ethan.

    Tim,
    Thanks for the response.
    I figured it out. The error message I was getting was because of some parsing issue. I have defined Year as "FY12" in quotes. I removed quotes & it worked.
    Thank You.
    Ethan.

  • How to use a substitution variable in a load rule?

    I need to use a substitution variable in a load rule in a column, as I will receive a parameter to fix the Month and Year values within the data loading, could somebody tell me if this is possible. I put an expresion "&Yearproc" in the column value but it is not working.

    If you're a member of ODTUG (or even if not, you can sign up for an associate membership for free) you can download Glenn's presentation from 2009 Kaliedoscope "Little Used Features of Essbase (Like Data Mining and Triggers)" -- there is a section in that presentation on substitution variables -- he does a really good job in showing how this works.
    Go to: www.odtug.com, then Tech Resources, then Essbase/Hyperion, and search for Schwartzberg. Currently it's the ninth presentation on the list -- I think this changes based on popularity of downloads.
    Regards,
    Cameron Lackpour

  • Define variable in SQL Loader Control File

    Hi,
    I have an input file where the first line is the header record, followed by the detail records. For the processing, I do not need to store the fields of the header record but I need a date field from this header record and store in as part of the detail record in an oracle record row.
    Is it possible to define a variable within the sql loader control file to store the value that I need in memory then use it when I do the sql insert by the sql loader?
    Thanks for any advice.

    Not sure that you can. But if your on unix/linux/mac its easy enough to write a shell script to populates the variables in a template file that you can then use as the ctl file. The perl template toolkit could be an option for that as well

  • Parameters / Variables in SQL Loader Control File

    Here's my problem, I have created SQL Loader control file (ctl) to load a file of employees. This loader program is registered in Oracle Applications. What I want is to pass a parameter derived from the profile like the user name of the one who executed the loader program and pass it to the loader program so that the user name info is included in the loading
    example
    input data
    123456,John,Smith
    654321,Jane,Doe
    loaded data
    123456,John,Smith,03-JUL-2009,USER13
    654321,Jane,Doe,03-JUL-2009,USER13
    the sysdate is easy because it can be defined in the column but what I really want to achieve is a parameter passed to the ctl file.
    Thanks in advance.

    Dear user!
    Please have a look at this thread.
    {thread:id=915277}
    In the last three posts I explain how to use a shellscript with AWK and SED to pass parameters to a controlfile.
    Please feel free to post again if you have some questions regarding my explanatory notes.
    Yours sincerely
    Florian W.

  • Variable in the Load Rule file

    Hi,
    We're running EAS 9.3.1 and trying to update a load rule to include a substitution variable in the header. The load rule works fine when the member name is defined explicitly and the variable works fine in the calc scripts. Any ideas? I tried removing the quotes and the & symbol already. See error below.
    Reading Rule SQL Information For Database [Plan1]
    Reading Rules From Rule Object For Database [Plan1]
    Unknown member [&CalcVersion] found while processing string ["Budget","&CalcVersion","Load","Functional"]
    Unexpected Essbase error 1019026
    Thanks.

    Did you remove the quotes by using the replace in "field Properties" and Global properties tab? I am trying to replace double quotes with null in the data file and it does not seems to be working.
    Thanks
    Yagna

  • Substitution Variable in Data Load Rule

    Hello,
    Is it possible to filter selected record or rejected record from a flat file using a substitution variable ?
    I use the v11.1.1.3.
    Thanks
    Rgds,
    Pierre

    A quich test on sample basic says no. I exported the data in column format and cleared the data. Then I created a load rule with selection criteria of a substitution variable and itdid not load any rows. I then changed the sub variable to an actual month and it loaded fine

  • SQL Load rules file

    Hi Experts,
    I'm trying to create SQL based load rule for BSO application.I'm not sure what i'm missing but in data field it shows " 0" or "-0" in EAS while retriving a data from Oracle.When I execute same query on oracle data was there.
    The data field which i'm not getting correctly is "SUM(aa."AMOUNT").Any suggestions ?
    Thanks in avd
    Vipul

    Hi Genn,
    I tried to see the app log for sql but i m afraid that there is nothing in there, the only error message which I am getting in app log is this:
    Failed to Establish Connection With SQL Database Server. See log for more information
    Its an ASO cube and initially i was using the variable as FY00 AS "2008" it did not work and than i tried without quotes in variable but is still not working.
    Any idea..thanks in advance.

  • Referencing a substitution variable in data load rule header definition

    Hi All,
    Im trying to add a substitution variable to the header definition of a DLR.
    the sub var is &CurrMonth.
    When I execute the data load I get an "unknown member error" with a list of all members in the header definition, including Oct which is my current month.
    It looks like the DLR is resolving the sub var but for some reason it is refusing to load data.
    We are on 9.2.0.1.
    Are sub vars referenced differently for DLR?
    Thanks for your help.
    Seb

    Hi Seb!
    Hope you're well. You're doing everything right with the subvars so the issue must be elsewhere. Is the list comma separated? Sorry I can' help more :(
    Gee

  • Essbase Load Rules File Header Issue

    Hi,
    Is it possible to specify more than one member for the same dimension in the Load Rules file Header?
    Example: I need to load the same data in all the remaining months in current year.
    I tried using a substitution variable in the header which is defined as Aug,Sep,Oct,Nov,Dec.
    It loaded randomly. For each account, only one month is loaded.
    It loads only as many data points as in the data file regardless of the number of members from the same dimension specified in the Header definition.
    Any suggestions to correct this.
    Using a Calc script to do a data copy cannot be used because of other process limitations.
    Appreciate your thoughts.
    Thanks,
    -Ethan.

    Randomly? That's really interesting. But yeah, I wouldn't expect that to work.
    I have a hard time thinking of a really good option that will handle an variable number of periods and is driven by a single subvar.
    Run the load multiple times, cycling through the subvar settings? Or (faster, if Period is dense) create one load rule for each period, with the data column copied multiple times using field manipulation and the future Periods assigned to each column (rather than using a 'Data' field) and run only the rule you need? That option doesn't use a subvar at all, but still requires conditional logic in the process.
    Alternatively, do the transformation in your source extract / parse the file. This is really the 'best' option but I appreciate there are sometimes constraints on changing upstream processes.

  • How to call sql loader ctrl file with in the pl/sql procedure

    Hi Friends,
    I am doing a project related with the transferring data using queues. In the queue , I will get a tab delimited data in the form of CLOB variable/message. I do want to store that dat in the oracle table.
    When updating data into the table ,
    1. Don't want to write that data into a file.( Want to access directly after dequeueing from the specfic queue).
    2. As the data is in tab delimited form, I want to use sql loader concept.
    How do I call the sql loader ctrl file with in my pl/sql procedure. When I searched , most of the forums recommending external procedure or Java program.
    Please Guide me on this issue. my preferrence is pl sql, But don't know about external procedure . If no other way , I will try Java.
    I am using oracle 9.2.0.8.0.
    Thanks in advance,
    Vimal..

    Neither SQL*Loader nor external tables are designed to read data from a CLOB stored in the database. They both work on files stored on the file system. If you don't want the data to be written to a file, you're going to have to roll your own parsing code. This is certainly possible. But it is going to be far less efficient than either SQL*Loader or external tables. And it's likely to involve quite a bit more code.
    The simplest possible thing that could work would be to use something like Tom Kyte's string tokenization package to read a line from the CLOB, break it into the component pieces, and then store the different tokens in a meaningful collection (i.e. an object type or a record type that corresponds to the table definition). Of course, you'll need to handle things like converting strings to numbers or dates, rejecting rows, writing log files, etc.
    Justin

  • Using variables in SQL Loader

    Is it possible to pass or set a variable in SQL LOADER? In this case I want the file name (eg $data) that is getting passed from the command line to load into my table into the extract_date field.
    For example. The command line:
    sqlldr user/password control=deposit.ctl data=080322.txt
    Control file:
    Load data
    infile '$data'
    Append into table deposit
    , id position (1-10)
    , extract_date date "YYMMDD" $data
    Any thoughts?

    user567866 wrote:
    Is it possible to pass or set a variable in SQL LOADER? In this case I want the file name (eg $data) that is getting passed from the command line to load into my table into the extract_date field.
    For example. The command line:
    sqlldr user/password control=deposit.ctl data=080322.txt
    Control file:
    Load data
    infile '$data'
    Append into table deposit
    , id position (1-10)
    , extract_date date "YYMMDD" $data
    Any thoughts?Just wonder, why do you need a variable, if you are passing the filename on the command line? The sqlldr is perfectly capable to read the data from the file given as argument with parameter data. Just remove the line with infile from your controlfile and leave your commandline as is.
    Best regards
    Maxim

  • Way to generate sql*loader ctl file from a table?

    I'm an oracle newbie. (Oracle 8i, HP Unix)Is there any way to take an existing table
    description and generate a sql*loader control file from it? If anyone has already written a procedure or knows where one can be found I'd really appreciate it. We're doing a mass conversion to oracle and would like an easy way to re-write all our loads.
    Thanks! Eileen from Polaroid.

    Hi,
    I have shell program, which will get column names from system table and create temp. control file and call sqlloader exe. and load the data automatically.
    You can customise this file, according to your needs.
    Shell Program
    if [ $# -ne 2 ]
    then
    echo " Usage : $0 table_name flat file name"
    exit
    fi
    #assigning envir. variable to unix variables
    table_name=$1
    flat_file=$2
    #creating the control file
    echo "LOAD DATA" > $table_name.ctl
    echo "INFILE '$flat_file'" >> $table_name.ctl
    echo "into table $table_name " >> $table_name.ctl
    echo "fields terminated by '\t'" >> $table_name.ctl
    #calling functions for making column name part
    #describing the table and spooling into file
    sqlplus -s $CUST_ORA_USER << sql_block
    spool $table_name.lst
    desc $table_name
    spool off
    sql_block
    # creating suitable file and add the feilds into control file
    # cutting the first line (headings)
    tail +3 $table_name.lst > temp
    rm -f $table_name.lst
    k=`wc -l < temp`
    k1=`expr $k - 1`
    #cutting the last line
    head -$k1 temp > tempx
    record_count=`wc -l < tempx`
    counter=1
    echo "(" > wxyz.ctl
    # reading file line by line
    cat tempx | while in_line=`line`
    do
    #cutting the first field
    field_name=`echo $in_line | cut -f1 -d' '`
    #calculating the no of characters
    word_cnt=`echo $in_line | wc -w`
    #calculating count in a line
    if [ $word_cnt = 2 ]
    then
    data_type=`echo $in_line | cut -f2 -d' ' | cut -f1 -d'('`
    if [ "$data_type" = "DATE" ]
    then
    data_fmt="DECODE(LENGTH(LTRIM(RTRIM(:$field_name))),'11',to_date(ltrim(rtrim(:$field_name)),'dd-mon-yyyy'),'9',to_date(ltrim(rtrim(:$field_name)),'dd-mm-yy'),'10',to_date(ltrim(rtr im(:$field_name)),'dd-mon-yy'),'yyyy/mm/dd hh24:mi:ss')"
    elif [ "$data_type" = "CHAR" ]
    then
    data_fmt="NVL(RTRIM(LTRIM(:$field_name)),' ')"
    elif [ "$data_type" = "VARCHAR2" ]
    then
    data_fmt="NVL(RTRIM(LTRIM(:$field_name)),' ')"
    else
    data_fmt="NVL(:$field_name,0) "
    fi
    else
    data_type=`echo $in_line | cut -f4 -d' ' | cut -f1 -d'('`
    if [ "$data_type" = "DATE" ]
    then
    data_fmt="DECODE(LENGHTH(LTRIM(RTRIM(:$field_name))),'11',to_date(ltrim(rtrim(:$field_name)),'dd-mon-yyyy'),'9',to_date(ltrim(rtrim(:$field_name)),'dd-mm-yy'),'10',to_date(ltrim(rt rim(:$field_name)),'dd-mon-yy'),'yyyy/mm/dd hh24:mi:ss')"
    elif [ "$data_type" = "CHAR" ]
    then
    data_fmt="NVL(RTRIM(LTRIM(:$field_name)),' ')"
    elif [ "$data_type" = "VARCHAR2" ]
    then
    data_fmt="NVL(RTRIM(LTRIM(:$field_name)),' ')"
    else
    data_fmt="NVL(:$field_name,0) "
    fi
    fi
    #if last line put );
    #else ,
    if test $record_count -eq $counter
    then
    echo $field_name \"$data_fmt\"");" >> wxyz.ctl
    else
    echo $field_name \"$data_fmt\""," >> wxyz.ctl
    fi
    #counter increamenting for each record
    counter=`expr $counter + 1`
    done
    #removing the file
    rm -f temp tempx
    cat wxyz.ctl >> $table_name.ctl
    rm -f x.ctl
    #calling the SQLLOADER
    SQLLDR $CUST_ORA_USER CONTROL=$table_name.ctl ERROR=99999999
    #removing the control file
    rm -f $table_name.ctl

  • Importing already-made SQL*Loader control files in OWB 10g

    Hi all,
    Suppose that I have a certain amount of already hand-made SQL*Loader control files, say 50 or so.
    Each of these control files have a variable quantity of fields.
    I feel really lazy, so I would like to know if it is possible to import directly these control files instead of re-typing them in the design center. That would save me a lot of time.
    Thanks !
    Burgy

    Hi Burgy
    One option is to use the sqlloader option to generate an external table from the SQLLoader control file (search for generate_only in the sqlloader documentation). If you define the external table in the database you can reverse engineer this into OWB.
    Cheers
    David

  • Passing file name dynamically to sql loader ctl file

    Hi,
    I am new to scripting and I have a complex requirement involving writing a script.
    Requierment:
    I need to upload a CSV file from a FTP server into oracle table using SQL Loader. The file name resembles like APF0912312359.csv represents 31-DEC-2009 23:59 and there will be multiple files in same day indicated by differnt timestamp as its filename. Once I load a file using SQL loader, I need to move the file to another directory for archival.
    Since the sql loader ctl file has a fixed file name, I would like to know how I can pass the file name dynamically to ctl file to load a new file every time it runs.
    Any help is greatly appreciated..
    Bye
    Sudheer
    Edited by: user2138419 on Oct 28, 2009 4:08 PM

    I agree with Pradeep in regards to declaring the file names on the command line. However, I do have a concern regarding presenting the password on the command line as any user that can issue a ps (assuming Unix ~= Linux here) would be able to read it while the sqlldr command is running.
    Unfortunately, you may not always have the option of declaring the files on the command line. I was recently challenged with this in a Windows 2003 Server environment running SQL*Loader: Release 10.2.0.1.0. In this environment I found that I am able to set a variable file name in a calling batch file and use that value in the control file successfully. Just to demonstrate the approach:
    Batch file:
    set IN_FILE=’c:\inbound\load_me.txt’
    sqlldr user/pswd@db PARFILE=’c:\parameters.txt’
    Parameter file:
    errors=500000
    rows=50000
    control=%CTL_FILE%
    bad=%BAD_FILE%
    discard=%DSC_FILE%
    log=%LOG_FILE%
    Control file:
    LOAD DATA
    INFILE ‘%IN_FILE%’
    INSERT
    INTO TABLE table_to_be_loaded
    I’m really interested to see if this would work on Unix.
    -Luke

Maybe you are looking for