Passing unix variable value to plsql block

hi..
i want to pass the value of a unix variable to a pl/sql block. I dont know how to go about it.
My code is
for all the files in the directory, ( say $i as the file name )
sqlplus -s <<!
cmdp_rdev/cmdp_rdev@cmdp
declare
no number:= 0;
BEGIN
no := run_owb_mapping('CMDP_RDEV','LOC_PROC_FLOW','PROCESS','PROCESS_HOTEL_DATA',CUSTOM_PARAMS='FILE_NAME=$i');
end;
In the above example, i want the file name ( if x.txt ) to be passed to the procedure call as :
no := run_owb_mapping('CMDP_RDEV','LOC_PROC_FLOW','PROCESS','PROCESS_HOTEL_DATA',CUSTOM_PARAMS='FILE_NAME=x.txt');
How do i do this..
thanx in advance

thank you for the reply..
well that will not work.. since values concatenated to strings cannot be passed as parameters.
for the file Oct_2005.csv, the following was the output
no := run_owb_mapping('CMDP_RDEV','LOC_PROC_FLOW','PROCESS','PROCESS_HOTEL_DATA'
,p_custom_params=>'FILE_NAME='''||Oct_2005.csv||'');
ERROR at line 4:
ORA-06550: line 4, column 115:
PLS-00201: identifier 'OCT_2005.CSV' must be declared
ORA-06550: line 4, column 1:
PL/SQL: Statement ignored
------------------------------

Similar Messages

  • Pass unix variable to pl/sql block

    I am calling a sql file from Unix shell program (sql file contains pl/sql block).
    Can I pass a unix variable to this pl/sql query?
    something like this inside the pl/sql block...
    declare
    begin
    select name into v_name from test where name = '${name}'   ----> need to get unix variable
    end;
    exit

    Satyki, my exact problem is the shell program is not accepting the input when i am trying to pass a variable
    to the pl/sql block. the variable is declared in the varibale file as d='01-SEP-08'
    this variable should replace the SQL where condition...
    Now when i call the shell
    $ test_1.sh '$d'
    test_1.sh[28]: 02-sep-08:  not found
    below is the shell
    #!/usr/bin/ksh
    . /home/btchproc/.profile
    . /home/btchproc/load_process/.BTCHVariables
    . /home/btchproc/load_process/.BTCHFunctions
    LOG_FILES_BATCH=$LOAD_BASE/log_files_batch/test_1.log
    echo " " >> $LOG_FILES_BATCH 2>&1
    echo "****************************************************" >> $LOG_FILES_BATCH 2>&1
    echo "**************  START OF THE PROCESS  **************" >> $LOG_FILES_BATCH 2>&1     
    echo "****************************************************" >> $LOG_FILES_BATCH 2>&1
    echo  >> $LOG_FILES_BATCH 2>&1
    date  >> $LOG_FILES_BATCH 2>&1
    echo "* EXECUTE test.SQL  *" >> $LOG_FILES_BATCH 2>&1
        SQL_NAME=test_1.sql ${d}
        run_sql test_1.sql  ${d}
    Below is the sql
    WHENEVER SQLERROR EXIT FAILURE;
    DECLARE
    x number;
    BEGIN
    -- Insert new daily assets and account records into the summ_new_temp table
    select count(1) into x from summ_new_wrap where trade_d = '&d' ;
    END;
    EXIT SUCCESS
    The variable is declared in BTCHvariable file
    ## * Name:          .BTCHVariables                               * ##
      LOAD_BASE='/home/btchproc/load_process'
      APPL_BASE='/home/btchproc/load_process'
      BATCH_DIR=$LOAD_BASE'/batch_files'
      BATCH_FILES_DIR=$LOAD_BASE/batch_files
      SQL_DIR=$LOAD_BASE/sql_files
      LOG_DIR_LOAD=$LOAD_BASE/log_files_load
      LOG_DIR_BATCH=$LOAD_BASE/log_files_batch
      FACTOR_THRHOLD=.03
      CONNECT_STRING='btchproc/test02'
      COUNT=0
      MAXRETCODE=0
      *d='02-sep-08'*
    ==================
    $ test_1.sh    
    test_1.sh[28]: 02-sep-08:  not found

  • How to pass session variable value with GO URL to override session value

    Hi Gurus,
    We have below requirement.Please help us at the earliest.
    How to pass session variable value with GO URL to override session value. ( It is not working after making changes to authentication xml file session init block creation as explained by oracle (Bug No14372679 : which they claim it is fixed in 1.7 version  Ref No :Bug 14372679 : REQUEST VARIABLE NOT OVERRIDING SESSION VARIABLE RUNNING THRU A GO URL )
    Please provide step by step solution.No vague answers.
    I followed below steps mentioned.
    RPD:
    ****-> Created a session variable called STATUS
    -> Create Session Init block called Init_Status with SQL
        select 'ACTIVE' from dual;
    -> Assigned the session variable STATUS to Init block Init_Status
    authenticationschemas.xml:
    Added
    <RequestVariable source="url" type="informational"
    nameInSource="RE_CODE" biVariableName="NQ_SESSION.STATUS"/>
    Report
    Edit column "Contract Status" and added session variable as
    VALUEOF(NQ_SESSION.STATUS)
    URL:
    http://localhost:9704/analytics/saw.dll?PortalGo&Action=prompt&path=%2Fshared%2FQAV%2FTest_Report_By%20Contract%20Status&RE_CODE='EXPIRED'
    Issue:
    When  I run the URL above with parameter EXPIRED, the report still shows for  ACTIVE only. The URL is not making any difference with report.
    Report is picking the default value from RPD session variable init query.
    could you please let me know if I am missing something.

    Hi,
    Check those links might help you.
    Integrating Oracle OBIEE Content using GO URL
    How to set session variables using url variables | OBIEE Blog
    OBIEE 10G - How to set a request/session variable using the Saw Url (Go/Dashboard) | GerardNico.com (BI, OBIEE, O…
    Thanks,
    Satya

  • Passing global variable values from databse to forms

    I am using forms 6i and database is oracle 9i.
    I am trying to run a form stand alone ( by pressing CTRL-R) without putting it in the application.
    since when this form is placed in the application menu it works fine as it has been passed global variables values from the database .
    now i am trying to run the form without menu and thus i want to pass the values of global variables .please let me know where should i pass these values in form .is it be WHEN-NEW-FORM-Instance trigger or in Pre-form trigger.
    i know what are the global variable values passing into the form from database.
    i can hard code any values to check if the form runs well or not.

    If you intend to do this sort of testing regularly you might want to consider creating a seperate form with a control block which allows entry of the name of the form you want to run, the names of the globals and their values, and do a CALL_FORM.

  • Passing CPM variable value to BW report/query

    Is it possible to pass CPM variable values from SEM scorecard to BW supporting reports.

    Not sure if this is what you are looking for, but it's my first thought of what I would try:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/3.0b report-report interface.pdf

  • Can we Pass two variable values in to one Varaible which is Cust Exit?

    Hi all,
    Can we pass two Variable values to a Variable which is Custexit?(For Example posting Period and the fiscalyear in to the FicalPeriod )
    Regards
    Kiran

    Hello,
    For that example you had to "convert" both post period and fiscalyear into fiscalperiod, and yes it is possible, but not throwing up the two values, you had to do it yourself in the user exit code.
    Diogo.

  • How to pass Temp variable value instead of Table name in From clause.

    Hi,
    I have an requirement to pass the Temperorary variable value instead of Table name in FROM Clause in SQL.
    But I am strugglint to pass this variable value.
    E.g., a Varchar2(5) := 'aa';
    Select * from a;
    Here I come to mention a - 'aa'. But the SQL looks for 'a' as Table. But its should look into 'aa' as Table name.
    Kindly guide me.
    Thanks.

    SQL> declare
      a     varchar2 (5) := 'emp';
      v     varchar2 (100);
      cur   sys_refcursor;
    begin
      open cur for 'Select ename from ' || a;
      fetch cur into v;
      while cur%found
      loop
        dbms_output.put_line (v);
        fetch cur into v;
      end loop;
      close cur;
    end;
    JAMES
    SCOTT
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    KING
    TURNER
    ADAMS
    FORD
    MILLER
    PL/SQL procedure successfully completed.

  • How to  pass a variable value into a custom planning function via a web

    Can some one tell me
    How to  pass a variable value into a custom planning function via a web template?
    What are the different types of Planning function parameters available and what is the difference between them?
    Thanks
    babu

    Hi Sutrtha,
    Yeah I got the pop up asking to select the variables used, I have selected ENTITY_ID that was used by the interfaces, but on execution of the package the Scenario did not work as the passeed variable #ENTITY_ID is set to 0 instead of the value I am passing.
    Am I missing something?
    Regards
    B

  • Virtual KF(as Date) in Cube and pass the variable value to this VKF runtime

    Hi ,
    User would enter 1 date using date variable untime.
    My cube also has 1 Completed Date (KF).
    And i wann do comparisan based on input variable and exisitng variable.
    Can i add 1 Virtual KF(as Date) in Cube and pass the variable value to this VKF runtime and do the calculation in cube ???
    I know the same thing i can do in formula , but i have some different req.which i am unable to explain u here .
    So please let me know can i use VKF if yes how ???
    Points would be thrown for all .
    Bapu

    it's the exact posting from your last post. Please don't duplicate the postings, so that we can help you in one thread and not so many different threads

  • Passing Unix variable into sql

    Hi,
    I have a shell script with embedded SQL.
    In the script I have a Unix variable that has a char value
    id="P_test".
    I need to pass this variable to a select in a where condition like
    select * from table where camp1=$id.
    The problem is $id returns P_test rather than 'P_test' so that the select can work.
    Any ideea how to change the clause where to make the select work?
    I could also change the variable id as to have id=" 'P_test' " , but this variable comes from a file parsed and I don't know how to get 'P_test' instead of P_test.
    Thanks

    another option may be like this example -
    $OH10/bin/sqlplus -s > $CIGDEM_LOG_DIR/step1_$CIGDEM_DATE.log 2> $CIGDEM_LOG_DIR/step1_$CIGDEM_DATE.err <<EOF
    $CIGDEM_USERNAME1/$CIGDEM_PASSWORD1@$OTNS10
    @$CIGDEM_DIR/step1.sql $CIGDEM_EXP_DIR $CIGDEM_USERNAME3 $CIGDEM_PASSWORD3 $PERMANANT_TABLESPACE $TEMPORARY_TABLESPACE
    exit ;
    EOF
    "@$CIGDEM_DIR/step1.sql $CIGDEM_EXP_DIR $CIGDEM_USERNAME3 $CIGDEM_PASSWORD3 $PERMANANT_TABLESPACE $TEMPORARY_TABLESPACE" here we call step1.sql with arguments, they will be used with &n symbol inside sql statement -
    .. CREATE USER &2 IDENTIFIED by &3 TEMPORARY TABLESPACE &5 DEFAULT TABLESPACE &4 ; ..http://tonguc.wordpress.com/2007/11/29/linux-and-shell-scripting-part-2/

  • Open a crystal report from WAD with passing  the variables values

    Hi,
    I need to know is there any way to link SAP WAD to crystal reports (open a crystal report from WAD)and pass the values of the variables which are entered in the Web App. (e.g. Customer id,year) should be passed to the Crystal Report.
    Maybe we need to pass parameter by WAD URL but this is just my assumption and have no idea how to do this with passing variable values.
    right now I know the method of how Bex queries which are used as data source for crystal reports but in my current scenario we have the structure like this that bex queries link with WAD and then WAD is linked with crystal reports.
    No doubt that Crystal report is target option in RRI but there the source is Bex Query only but in current scenario we are looking  WAD (web template) as a source to crystal report or crystal report called in WAD.
    Please suggest something on same.
    Thanks
    Take care
    Vishal sharma

    Hello Vishal.
    Did you find a solution for this problem?
    I'm facing right now the same problem, I need a way to link SAP WAD to crystal reports (open a crystal report from WAD) and pass the values of the variables which are entered in the Web App. (e.g. Customer id,year) should be passed to the Crystal Report.
    Have found an answer to this issue? If yes, please kindly inform how have you solved this.
    Best Regars
    Armando Santos

  • How to pass the  variable value to reports as a parameter

    hi
    i have facing a problem that i want to pass the value of a variable that i had calculate in a procedure like
    SELECT nvl(BASIC_PAY,0) INTO v_basic FROM EMP WHERE EMP_ID=P_EMP_ID;
    so i want to send the variable value v_basic as a parameter through form to report...and simlarly other variables values which i have calculate in procedure....
    need ur help to solve this problem
    thanks in advance

    it's the exact posting from your last post. Please don't duplicate the postings, so that we can help you in one thread and not so many different threads

  • RRI - Jump query, unable to pass the variable value from source to target

    Hi,
        I've a source query which has a variable on 0vendor, from this query i jump to another query for which i want to pass the this variable value, in the target query i've vendor in free characteristics (no filter or variable in there), and in RSBBS i tried the assignment details options keeping vendor as generic, tried variable and the variable name but nothing seem to work.
    But when query is run i can jump into target query but the vendor variable value doesnt get passed thru the values i get in target query is for all rather than for the variable entered vendor value in the source.
    btw we're in NW2004s.
    any help appreciated with points.
    thanks
    Mayil

    Anyways, I read somewhere that a variable with replacement path in target query would work, tried it seem to work.
    let me know if there other way to do it without creating a variable in target query.
    thanks
    mayil

  • How to pass Presentation Variable Value from Main Report to Detail Report

    Hello,
    I've 2 reports that is attached to each other. In my main report i've several report prompts and i am using i"s prompted" on my detail report to attach them.
    But 2 of my report prompts are presentation variables(Names : FIRST, SECOND). Both are in date format. I've a filter in my main report like;
    "ASSIGNMENTS_F"."EFFECTIVE_START_DATE" BETWEEN @{FIRST} AND {SECOND}
    It works fine when i run the main report. But when i click on the numbers, i see that i can not filter my detail report with the chosen values for 2 presentation variables. It just shows all the dates.
    I've tried adding both presentation variables in both reports as columns and adding 'is prompted' filter to them. But did not work either.
    I just cant pass the written values for presentation variable prompts to detail report..
    Please help :)

    Hi,
    What you can try is refer the filte condition in the main report to the detailed report with the option--> Filter based on another request.
    Or you try creating another intermediate report which will refer the main report filters and pass the filters to the detailed report.
    Hope this helps.
    Regards
    MuRam

  • Passing a variable value from one query to another within a web template

    Hi All,
    I have a web template with two queries.  Both queries have the same select option variable called ZSELCUST on the characteristic ZCUSTOMER but because they are different info providors (both infocubes) the customer has to be entered once for each query, even with the 'Display same variable only once' flag checked.
    I want the user to select the customer once and then that value be passed to the other query within the resulting web template output.
    Am I right in that the same variable is used more than oncee because of the different info providors?
    I'm struggling, can anyone help out there....???
    Best Regards,
    Stuart Humphrey

    Hi
    A way of doing this is by "linking" the queries: in transaction RSBBS you define the sender and receiver queries. In query navigation you can jump to the dependent query (blue arrow icon in the BEx tool bar). This transfers the navigational state to the called query: filters over characteristics and variable values.
    Hope this help
    German

Maybe you are looking for