Script fails when passing values from pl/sql to unix variable

Script fails when passing values from pl/sql to unix variable
Dear All,
I am Automating STATSPACK reporting by modifying the sprepins.sql script.
Using DBMS_JOB I take the snap of the database and at the end of the day the cron job creates the statspack report and emails it to me.
I am storing the snapshot ids in the database and when running the report picking up the recent ids(begin snap and end snap).
From the sprepins.sql script
variable bid number;
variable eid number;
begin
select begin_snap into :bid from db_snap;
select end_snap into :eid from db_snap;
end;
This fails with the following error:
DB Name DB Id Instance Inst Num Release Cluster Host
RDMDEVL 3576140228 RDMDEVL 1 9.2.0.4.0 NO ibm-rdm
:ela := ;
ERROR at line 4:
ORA-06550: line 4, column 17:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
( - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
The symbol "null" was substituted for ";" to continue.
ORA-06550: line 6, column 16:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
( - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev su
But when I change the select statements below the report runs successfully.
variable bid number;
variable eid number;
begin
select '46' into :bid from db_snap;
select '47' into :eid from db_snap;
end;
Even changing the select statements to:
select TO_CHAR(begin_snap) into :bid from db_snap;
select TO_CHAR(end_snap) into :eid from db_snap;
Does not help.
Please Help.
TIA,
Nischal

Hi,
could it be the begin_ and end_ Colums of your query?
Seems SQL*PLUS hs parsing problems?
try to fetch another column from that table
and see if the error raises again.
Karl

Similar Messages

  • Passing value from plsql back to UNIX

    I have a shell script which calls out to a plsql program using sqlplus command, but how do I return the values from the plsql program (a simple SELECT statement) back to the Unix script? Thanks.
    James

    Create one UNIX script
    eg :- C2_ATG_Insert.sh
    #!/usr/bin/ksh
    #Variables to store the values
    count=0
    Count_ILX_EXCH=0
    Count_ILX_CBOE_SERIES=0
    Count_ILX_UNDLY_INST=0
    Count_STOCK_TIPS=0
    Count_TIPSSUM=0
    # Block to check whether date is passed as a parameter
    if (($# != 1))
    then
    echo "Usage: C2_ATG_Insert.sh dd-mon-yy"
    exit 1
    fi
    # Assign the trade date to a variable
    Temp_Date=$1
    # Call the sql, Count_Temp.sql with date as parameter
    sqlplus usernam/password@Database_Name @Counts_Temp.sql $Temp_Date
    # remove the blank lines
    sed '/^$/d' Counts_Temp.lst > Counts_C2ATG.lst
    # Store variables from the spooled file which gets generated in Count_Temp.sql into variables defined
    while read myline
    do
    count=$(($count + 1))
    case $count in
    1) Count_ILX_EXCH=$myline ;;
    2) Count_ILX_CBOE_SERIES=$myline ;;
    3) Count_ILX_UNDLY_INST=$myline ;;
    4) Count_STOCK_TIPS=$myline ;;
    5) Count_TIPSSUM=$myline ;;
    esac
    done < Counts_C2ATG.lst
    echo "ILX_EXCH Count $Count_ILX_EXCH"
    echo "ILX_CBOE_SERIES Count $Count_ILX_CBOE_SERIES"
    echo "LX_UNDLY_INST Count $Count_ILX_UNDLY_INST"
    echo "STOCK_TIPS Count $Count_STOCK_TIPS"
    echo "TIPSSUM Count $Count_TIPSSUM"
    if [ $Count_ILX_EXCH -eq 0 ] || [ $Count_ILX_CBOE_SERIES -eq 0 ] || [ $Count_ILX_UNDLY_INST -eq 0 ] || [ $Count_STOCK_TIPS -eq 0 ] || [ $Count_TIPSSUM -eq 0 ]
    then
         echo "*********** Count in one of the tables is Zero *****************"
         exit 1
    fi
    Create the SQL File eg Count_Temp.sql
    SET heading off
    SET VERIFY OFF
    SET PAUSE OFF
    SET ECHO OFF
    SET TIMING OFF
    spool Counts_Temp.lst;
    select count(*) from ILX_EXCH where trade_date= '&&1'
    UNION ALL
    select count(*) from ILX_NONCBOE_SERIES where trade_date= '&&1'
    UNION ALL
    select count(*) from ILX_UNDLY_INST where trade_date = '&&1'
    UNION ALL
    select count(*) from STOCK_TIPS where trade_date = '&&1'
    UNION ALL
    select count(*) from TIPSSUM where trade_date ='&&1
    spool off;
    exit;
    Do reply in case you are unable to undertand any part of the scripts

  • Passing value from MD form to bind variable in report

    I have an MD form, after I insert I want to redirect to a form and pass a value out of the detail section to the form to use as the value of it's bind variable. This works well on normal forms, but I cant seem to get it to work on the MD form. Below is an easy example and this doesnt work for me.
    MD form master dept/detail emp, code under the save button:
    doSave;
    declare
    l_empno integer;
    l_url varchar2(2000);
    begin
    l_empno := p_session.get_value_as_NUMBER(
    p_block_name => 'DETAIL_BLOCK',
    p_attribute_name => 'A_EMPNO',
    p_index => 1);
    l_url := 'SCOTT.EMP_RPT.show?'&#0124; &#0124;
    'p_arg_names=empno&p_arg_values='
    &#0124; &#0124;l_empno;
    portal30.wwa_app_module.set_target(l_url,'CALL');
    end;
    The form displays the empolyee information based on the value of empno from the MD form. The url looks like this http://hostname/pls/portal30/scott.emp_rpt.show?l_arg_names=empno&l_arg_values=
    so no rows get returned because there is no value, if i fill it in with a empno it works, so i know the report works, it just isnt the get_value isnt grabbing the empno from the MD form.
    null

    I figured it out, the save button on a MD form, the doSave; clears out the form fields so do a get_value_as will not work b/c there is nothing there, you need to get the value before the doSave; the below code will work.
    declare
    l_empno number;
    l_url varchar(2000);
    begin
    l_empno := p_session.get_value_as_NUMBER(
    p_block_name => 'DETAIL_BLOCK',
    p_attribute_name => 'A_EMPNO',
    p_index => 1);
    doSave;
    l_url := 'scott.EMP_RPT.show?'&#0124; &#0124;
    'p_arg_names=empno&p_arg_values='
    &#0124; &#0124; l_empno;
    portal30.wwa_app_module.set_target(l_url, 'CALL');
    end;

  • Passing values from javascript in pop up window to parent jsp

    Hi
    I am trying to pass values from a pop up window to the main window that popped this child window , with the idea to have the parent window refresh itself with value from pop up window.But the values are not going through.I do a request on the hidden variable but when the parent
    jsp refreshes , the variable is still null...
    The following is the code i have .
    Parent jsp:a.jsp
    <form name='summary'>
    <input type=hidden name=customerid value="">
    <input type="button" class="textButton" name="action" value="customerlist" onClick="javascript:openWin('b.jsp','800','350')">
    <script>
    function openWin(loc, w, h) {
    var newWin = window.openloc,"HTML",'dependent=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + w + ',height=' + h);
    newWin.window.focus();
    </SCRIPT>
    <%
    String optionVal = request.getParameter("customerid");%>
    var user = "<%= optionVal%>";
    </form>
    child jsp- b.jsp (pop up window)
    <script>
    function closer(){
    var val = document.formname.id.selected.value;
    window.opener.document.summary.customerid.value = val;
    window.opener.location.reload();
    </script>
    <form name = formname>
    <input type="text" name="id" value = ''>
    <input type="button" class="textButton" value="select"
    onClick="closer();window.close();">
    </form>
    Any ideas on what i am missing
    Thanks
    Arn

    use window.opener.document.forms[0].filedname.value = 'value u need to set'

  • Java Thread - difficulty while passing value from parent to child thread

    Hi All,
    I am calling a java program from a unix script .
    My oblectives are
    1)to pass value from scripts to main java class
    2)main class should create a child thread and pass data to child and should return control back to script
    3)child thread should run independtly of parent
    The calling unix script is part of process and hence should return control back to its calling script immediately.
    Findings
    1)Without passing data thru setter getter /constructor method to child thread my objectives are met
    2)When I pass the data from parent thread to child thread calling unix scripts wait till child thread finishesh its working
    call.scr
    java Main <list of Arguments>
    Main.java
    public class Main
                 public static void main(String args[]) throws Exception
                 String data2="Z";
                 String data1=null;
                 for(int i=0;i<args.length;i++)
                      data2=data2+","+args;
    data1=data2;
    Child cu=new Child();
    cu.setData(data1);
    data2=null;
    data1=null;
    cu.start();
    Child.javaclass Child extends Thread
    public String data;
    void setData(String data)
    this.data=data;
    public void run()
    ----------> processing on data
    I think due to passing of data from parent thread to child thread (Inter thread data communication/Inter process communication)
      the threads are not working as desired.
    Plz anybody can suggest something.....
    Thanx.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    aschin,
    You seem to be confusing Java Threads with Operating System Processes.
    If you want you're java program to run in the unix background then you'll need to run it in the unix background. Java (being o/s agnostistic) doesn't provide process manipulation functionality (which would include the ability to throw itself into the background, as a C program can) in the standard API, and it's hard to imagine any third party producing anything as low level as a process controler... so yeah, just start the java program in the background... and you'll need to workout some interprocess communication protocol... named pipes have worked well for me in the past, as they doesn't suffer from the quit same performance issues as real disk files.
    Good luck. Keith.

  • Passing values from a FORM to another FORM

    Hi,
    I have to pass values from FORM "A" to FORM "B". What is the best way to do this?\
    Can I use a GLOBAL variable?
    Thanks,
    Marc.

    I think he meant the global namespace.
    You set a :global_your_name_here to a value and that value is available in your entire application. See the help file section on the global namespace for more information.
    Forms parameters are parameters that you form picks up from the outside when it starts. The calling entity must supply them in the URL or they will be set to null. You set them up in the object navigator in the Parameters node.

  • Re: Help needed in passing values from workflow to Approve Forms

    Dear Experts,
    how do I pass values from a workflow to a step (Form) - approve form?
    I am using a customized table structure as my data source (FORMCONTAINERELEMENT) but am stuck on how to access the data when i get to to the screen painter's flow logic... What am i missing? Can you give me a step by step example. the ones i see on the net are input fields that update the screen... nothing that shows value being passed from the outside.
    I need to pass an exisitng value in the workflow into the form for approval of the the assigned agent.
    Please help!!
    Thank you.

    Hello !
             Create a method just before the form step.This method should populate the values for the fields maintained in the form.
             Pass the values populated from this method to your customized table structure (data source).In other words, you have to pass all the values to the workflow container.
            To the step, pass this workflow container by binding.In the control tab of form step, you have to do the binding.
    Regards,
    S.Suresh

  • Passing value from JSP to JApplet

    Hello,
    I am stuck up with a problem, can anyone please tell me how do i pass a value from a JSP page
    to a JApplet,
    and the parameter passed through JSP should be displaed in the JTextArea.
    It would be kindful if any of you could help.
    Thanks
    Sanam

    hello,
    thanks for reply.
    I know how to pass parameters from html,
    I want to pass values from jsp page,
    and i dono how to do it, may be we cann pass values through url connection but i dono how.
    if anone knows plz help me in solving this.
    i hvae posted my applet code.
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.JToolBar;
    import javax.swing.JButton;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.JPanel;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    <applet code = "DocApplet" width = 500 height =5000>
    </applet>
    public class DocApplet extends JApplet
         private JPanel jp;
         private Container cp;
         private JTextArea jt;
         private JToolBar tb;     
         private JScrollPane sp;
         private String annotation;
         private String url;
         private Connection con;
         private Statement stmt;
         public void init()
              jp = new JPanel();
              cp = getContentPane();
              jt = new JTextArea();
              tb = new JToolBar();
              sp = new JScrollPane(jt);
              repaint();
         public void start()
              jp.setLayout(new BorderLayout());
              jp.add(tb, BorderLayout.NORTH);
              jp.add(sp, BorderLayout.CENTER);
              jt.setBackground(Color.BLACK);
              jt.setForeground(Color.WHITE);
              setContentPane(jp);
              addButtons(tb);
              repaint();
         public void run()
              repaint();
         public void paint()
         private void addButtons(JToolBar tb)
              JButton button = null;
              button = new JButton("Save");
              button.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
              tb.add(button);
    }

  • Passing value from JavaScript window to form

    Hi,
    Coul'd You help me?
    I have a test form. I open new JavaScript window from this form. I generate list of authors in this window by the procedure show_list. I want to pass value from JavaScript window back to test form, but
    the command "window.opener.document.forms[idx_form].elements[idx_fld].value = val;"
    don't pass value to test form. Where is mistake?
    Thanks Vaclav
    -------------- test form --------------
    <HTML>
    <HEAD>
    <META http-equiv="Content-Type" content="text/html; charset=windows-1250">
    <TITLE>Edit</TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Comment out script for old browsers
    function get_list(frm, fld)
    var idx_form, idx_fld;
    idx_form = get_idx_form(frm);
    idx_fld = get_idx_field(idx_form, fld);
    var w = open ("http://vasekora/pls/portal309/ahs.RD_CISEL.SHOW_LIST" + "?startPg=1" + "&master_fld=" + "ID_AUTHOR" + "&slave_fld=" + "NAME" + "&ownr=" + "REDAKCE" + "&tbl_name=" + "AUTHORS" + "&cmd_qry=" +"" + "&idx_form=" + idx_form + "&idx_fld=" + idx_fld,"wn_Authors","width=500,height=600,resizable=yes,menubar=yes, location=yes");
    if (w.opener == null)
    w.opener = self;
    w.focus();
    function get_idx_form(p_form_name)
    var v_index, v_full_name, v_return;
    for(v_index=0; v_index < document.forms.length; v_index++)
    v_return = -1;
         v_full_name = document.forms[v_index].name.split(".");
    if (v_full_name == p_form_name)
         v_return = v_index;
              break;
    return v_return;
    function get_idx_field(idx_form, field_name)
    var v_index, v_full_name, v_return;
    for(v_index=0; v_index < document.forms[idx_form].length; v_index++)
    v_return = -1;
         v_full_name = document.forms[idx_form].elements[v_index].name.split(".");
    if (v_full_name == field_name)
         v_return = v_index;
              break;
    return v_return;
    //-->
    </SCRIPT>
    </HEAD>
    <BODY>
    <FORM NAME="f_aut_new" ACTION="javascript:testclose()" METHOD=POST TARGET="_blank">
    <INPUT TYPE="text" NAME="id_aut">
    <IMG SRC="images/list.gif" alt="Seznam" border="0" align=bottom><BR><BR>
    <INPUT TYPE="submit" VALUE="Save">
    <INPUT TYPE="reset" VALUE="Cancel">
    </FORM>
    </BODY>
    </HTML>
    -------------------- end test form --------------
    procedure show_list
    startPg integer,
    master_fld varchar2,
    show_fld varchar2,
    ownr varchar2,
    tbl_name varchar2,
    cmd_qry varchar2,
    idx_form integer,
    idx_fld integer
    is
    TYPE cur_typ IS REF CURSOR;
    c cur_typ;
    c_cnt cur_typ;
    i integer;
         pg rd_types.pages_t;
    odkaz varchar2(4000);
    bk_url varchar2(4000);
         s1 varchar2(4000);
         var_mfld integer;
         var_sfld varchar2(8000);
         bl boolean;
         var_cmd varchar2(2000);
    begin
    htp.HTMLOPEN;
    htp.HEADOPEN;
    htp.p('<SCRIPT LANGUAGE="JavaScript">');
    htp.p('<!-- Comment out script for old browsers');
    htp.p('function Close_List(val, idx_form, idx_fld)');
    htp.p('{');
    htp.p('window.opener.document.forms[idx_form].elements[idx_fld].value = val;');
    htp.p('self.close();');
    htp.p('}');
    htp.p('//-->');
    htp.p('</SCRIPT>');
    htp.HEADCLOSE;
    htp.BODYOPEN;
    if cmd_qry is null then
    s1 := 'SELECT a.'||master_fld||', a.'||show_fld||' FROM '||ownr||'.'||tbl_Name||
    ' a ORDER BY a.'||show_fld;
    else
    var_cmd := UPPER(cmd_qry);
    s1 := 'SELECT a.'||master_fld||', a.'||show_fld||' FROM '||ownr||'.'||tbl_Name||
    ' a WHERE UPPER(a.'||show_fld||') LIKE ''%'||var_cmd||'%'' ORDER BY a.'||show_fld;
    end if;
    i := 1;
    OPEN c FOR s1;
    LOOP
    FETCH c INTO var_mfld, var_sfld;
    IF c%FOUND THEN
    IF i >= pg.StartRec AND i <= pg.EndRec THEN
    odkaz :=''||var_sfld||'';
    htp.p(i||': '||odkaz||' ('||var_mfld||')<BR>');
    ELSE
         IF i > pg.EndRec THEN
         EXIT;
         END IF;          
    END IF;
    ELSE
    EXIT;
    END IF;
    i := i + 1;
    END LOOP;
    htp.p('<BR><B><INPUT TYPE=BUTTON ONCLICK="javascript:self.close();" VALUE="Close"></B><BR><BR>');
    CLOSE c;
    htp.BODYCLOSE;
    htp.HTMLCLOSE;
    end;

    If this makes any difference: Instead of using "var w = open..." try "var w = window.open..."

  • How to retrieve the values from PL/SQL table types.

    Hi Every one,
    I have the following procedure:
    DECLARE
    TYPE t1 IS TABLE OF emp%ROWTYPE
    INDEX BY BINARY_INTEGER;
    t t1;
    BEGIN
    SELECT *
    BULK COLLECT INTO t
    FROM emp;
    END;
    This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
    Can anybody help me please!!!!!
    Thanks
    Ahmed.

    You mean, you can't add this
    for i in t.first..t.last loop
    dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
    end loop;or you can't add this
    set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
    You see, not able like very similar it is not working - both are too vague...
    Best regards
    Maxim

  • Passing Value from Crystal Report (special function) to Business View parameter

    Friends,
                 Í have a scenario where i need to pass value from Crystal Report to a Business view's parameter.
    Eg : CurrentCEUsername (func in crystal report)-- gives login user  which i should pass to parameter in a Business view (used in the same report).
    Will be able to explain more if required.
    Thanks in Advance,
    Bharath

    I guess you got the picture wrong.  User_id is not a report_level parameter .
    In Data Foundation, below query is used..
    select Acc_Number, Account_Group,User_id  from Accounts where user_id={?User_id}
    where in {?User_id}  is the BV parameter...
    The Filter was a solution. But it takes long time to Query all the data from DB and then filter at BV level.
    How do i pass the CurrentCEUsername to {?User_id}
    Value should ve CurrentCEusername always. so that query will be
    select Acc_Number, Account_Group,User_id  from Accounts where user_id=CurrentCEusername
    It will restrict the data pulled from DB to BV .. right?

  • Pass value from Java to Perl

    Anyone knows how to pass value from Java to Perl program?

    Did you write the perl program? Can you change it? Or are you trying to interface to something that already exists? This will limit your options, of course.
    Anyway the first option is simple. The java program does this:
    System.out.println("This is a line of input.");The perl program does this:
    while(<>)and in that block, $_ is assigned to each line of input.
    Then you can invoke both like this:
    $ java MyJavaProgram | perl MyPerlProgram.pl

  • Pass Value from Excel to custom program

    Hello,
    I want to pass value from Excel to Custom Program being called in the Custom Integrator and i am using the Import in the Importer section but it is not getting passed.
    Please advise and i am on R12.1.3.
    Thanks

    Pl do not post duplicates - Concurrent Program Parameter

  • How can I pass values from one node to another

    Give a standard and efficient way to pass values from child to parent

    hai Prathap
    You can use the custom event  for passing values from child to parent

  • Passing value from Webdynpro ABAP to Adobe form..

    Hi experts,
            In first view of web dynpro, im getting employee id as input and after clicking the create new button, an adobe form is called
    to create the employee details ( in form i used the submit button and i stored the details ). so, in tat form i used the employee id as read only mode and it has to display the value which i given as input. But in tat form im not getting the value from web dynpro..
    can anyone plz help me out for this..
    Thanks in advance..

    Hi,
    Try to set your values in Method->"wddomodify" of the View in which Adobe Form is present. If you want to pass values from one view to another then check this link [Passing Local Parameters between views in an ABAP Web Dynpro Application|http://wiki.sdn.sap.com/wiki/display/stage/PassingLocalParametersbetweenviewsinanABAPWebDynproApplication] or use Context declared in Component Controller.
    Regards
    Pradeep Goli

Maybe you are looking for

  • IDOC creation after the creation of a purchase order

    Hi everybody,             I want some configuration details regardign IDOC creation. The requirement is, once i create a purchase order in one system, the details should automatciaclly transfer to other system through IDOC. could any one suggest any

  • Use of Emigall for creation of masters in the production environment

    Hi, The EMIGALL objects are normally used for migrating legacy master data and/or cut-over data before production environment is up. I am contemplating to use EMIGALL object for creation of contract account masters in production environment. One more

  • The use of id attribute in html tags

    Hi I use http://java.sun.com/jsf/html as follows: <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%> <h:form id="myid"> <h:panelGrid id="mypanelgrid" columns="1"> </h:panelGrid> </ht:form>When I don't use the id attribute with the UI componen

  • User Details - Resources

    Hi everyone, I have installed OIM 11g R2 successfully. I created a new user. When I want to see user's detail, following options open : Attibutes Roles Entitlements Accounts Direct Reports Admin Roles I want to provision a Resources, but Resources is

  • Help with CUA and modifying user "own profile".

    Hey guys, We just implemented CUA in our enviornemnt, and have run into the system. I understand why all accounts now get modified in the central system, however, our users are asking to be able to still modify thier account defaults (i.e. hour forma