Binding Vars to ViewObjectImpl

All,
I have create a ViewObjectImpl object following the tutorials to Using Programmatic View Objects for Alternative Data Sources.
All went well and the class is complete. In the retrieveRefCursor method, I need to extract the bind params to call my stored function (returns a ref cursor)
Now the quesion
Where/How do I bind variables so they are passed into this procedure by the framework?
I have dropped the view onto a form and created a read only table, but how do I bind the variables I need to pass to the stored procedure?
Thanks in advance
Gary

Gary,
on the VO, expose a method (public) in the ViewObjectImpl class as a client interface (double click onto the VO to see the dialog where to do this). Once the method is exposed, it will show in the data control palette for drag and drop or manual binding
Frank

Similar Messages

  • Error with report - pkg and bind var

    Hi to all,
    i'm writing some report and i found a strange isssue.
    I would like to retrieve some data using packages.
    So, something like select dbms_xxxx(var1, var2, var3) from dual;
    I would like to pass through bind vars the value per each variable.
    I used :var1 and also &var1 to be secure..
    if i use select dbms_xxxx(':var1', ':var2', ':var3') from dual;
    it gives me error about the apex, so i changed it in
    select dbms_xxxx(par1 => :var1.....
    Now it gives a problem with the parenthesis. But they are right!
    Any ideas? A possible limit of developer?
    By the way.. latest sqldev version.
    Thanks
    Acr

    Example:
    SELECT DBMS_METADATA.GET_DDL(
    object_type => upper(&object_type),
    object_name => upper(&object_name),
    schema => upper(&schema)) DDL
    FROM DUAL;
    This i what i get.
    Error: ORA-00907 MISSING RIGHT PARENTHESIS
    using &var or :var
    Acr

  • How to use bind vars in SQL*Plus Script?

    I am trying to use a bind var in my script ... does not seem to work ... something along these lines.
    variable v_id number;
    select max(user_id) into :v_id
    from user_id_tbl;
    exec trace_user(:v_id);
    This is in a UNIX Script - I don't get any errors but the binding is not working - not passing a valid v_id ... Any ideas?

    For the record a solution is:
    variable v_id number;
    begin
    select max(user_id) into :v_id from user_id_tbl;
    end;
    exec trace_user(:v_id);
    -- CJ

  • Bind vars and LOVs on same JSP -incompatible?

    I have managed to get a project working using bind variables, and another project working that has LOV. (Both using ADF,struts,JSP)
    However, when I try and use bind variables for one attribute and an LOV for a different attribute on the same JSP I get the error msg:
    No getter method available for property x for bean name org.apache.struts.taglib.html.BEAN
    at org.apache.struts.taglib.SelectTag.calculateMathcValues(SelectTag.java:327)
    Is it not possible to have bind vars and LOVs on the same page or have I just messed sthg up?(more likely...) Seems weird that I can get them working separately. Any help appreciated... not knowing Java I'm rather at my wits end...!

    Hi kian chye,
    unfortunately it is not possible to use the page item bind variable in shared components for more than one page.
    If you want to get it to work you have to use application item in the LOV (shared components).
    Then on change of the first selection (region) you should write the new selection (region) into the application item (maybe with a javascript code). Then the LOV of the city should work.
    For the javascript code see an example here:
    http://apex.oracle.com/pls/otn/f?p=31517:119
    Regards,
    Denise
    www.appsassociates.de

  • Oracle 10g Diff in execution plan query with binding var Vs without

    We recently did 10g upgrade. In 10g, execution plan differs for query with binding var(thru jdbc etc) Vs without it as given below. For query with binding var,
    it chooses poor execution plan(no index is used, full scan is done etc). everything worked fine in 9i. To rectify the problem, we have to hint query with right index,join etc. but i dont like this solution.
    I would rather prefer to correct database to choose right execution path instead of eacy query level. but not sure what causes the issue.
    Does anybody came across this issue? if so, Please share your experiences. Thanks for the help. Do let me know if you need more info.
    1. Query without binding bar:
    select * from test where col1 = :1 and col2 = :2
    1. Query without binding bar:
    select * from test where col1 = 'foo' and col2= 'bar'

    I am not an expert but in my humble opinion it is the developer's responsability to ensure the correct explain plan is used before deploying code to production, if the explain plan returned by the DB is bad, then the use of a hint is perfectly acceptable.
    Check this out: http://lcgapp.cern.ch/project/CondDB/snapshot/performance.html
    Excerpt:
    Bind variable peeking. If an SQL query contains bind variables, the optimal execution plan may depend on the values of those variables. When the Oracle query optimizer chooses the execution plan for such a query, it may indeed look at the values of all bind variables involved: this is known as "bind variable peeking".
    In summary, the execution plan used for a given SQL query cannot be predicted a priori because it depends on the presence and quality of statistics and on the values of bind variables used at the time the query was first executed (hard-parsed). As a consequence of this instability of execution plans, very different performances may be observed for the same SQL query. In COOL, this issue is addressed by adding Oracle hints to the queries, to make sure that the same (good) plan is used in all cases, even with unreliable statistics or unfavourable bind variables.
    Edited by: Rodolfo Ferrari on Jun 3, 2009 9:40 PM

  • Query with bind var created under apex to generate xml data

    Hi all;
    BiP: 10.1.3.4
    Apex: 4
    DB 10G
    Goal: want to generate a report by running a query with bind variables under apex.
    problem: when attempted to create a query under shared components in apex, at the downloading xml data stage, I always get "no data found" eror. Thus I can't save xml data for further report work. This only occurs when bind var involved. I have tticked "incl. session variables" and added the item but to no avail.
    Does anyone know how to do this and get the xml data to recive the bind variable ?
    Thanks.
    lulu

    To get the xml data, sql query has to return something. Why the sql is not returning anything can be better investigated outside the BI Publisher with special tool like SQL Developer or TOAD. There you have to run your query and make it working. One of the steps would be to try the sql without the parameter, see what data it brings back and go from there. One of possibilities why the parameter kills the output may be the NULL values involved, but you need to try the sql outside the BIP first.

  • Using LOV with bind var as custom attribute?

    I have an Portal LOV which uses a bind variable.
    Can I use this LOV as a custom attribute? If so, how do I specific the bind variable value?
    In the display option of the attribute I tried LOV_NAME(LOV_Bind => 'value'), but the LOV is not applied.

    It's been quite a while, but I think I remember trying this and not being able to achieve it. You can use a LOV with a bind variable in a report or in a form, or similar, but there is no way in an item to from specify where to get the bind variable. My suggestion if this is a requirement would be to use a portal form which submits to a stored procedure or pl/sql generated form to gather the attributes and then programmatically create the item using the APIs. Takes a bit of work, but gets you exactly what you described above.
    Rgds/Mark M.

  • How to have a dynamic sql query clause as a bind var ?

    Hi Folks ,
    I need to set up a bind variable something like so
    i_name in varchar(10);
    begin
    select * from tablename where col1 == :i_name
    end
    any ideas ?

    Hi,
    Here's an example of using a bind variable in SQL*Plus:
    SET     SERVEROUTPUT ON   SIZE 10000
    VARIABLE     target_job     VARCHAR2 (10)
    EXECUTE     :target_job := 'CLERK';
    BEGIN
         FOR  emp_rec IN     (
                             SELECT     ename
                   ,     job
                   FROM     scott.emp
                   WHERE     job     = :target_job
         LOOP
              dbms_output.put_line (emp_rec.ename
                             || ', '
                             || emp_rec.job
         END LOOP;
    END;
    /What are you trying to do?

  • Detail Reports must be Refreshed if Bind Vars are Changed

    I have several "Master / Detail" reports where the Master has columns that are passed to the detail reports as Bind Variables.
    We've noticed that the Detail reports always return the report for the first bind variables sent to the report. To update the detail report based on the new bind variables, the admin must hit the report refresh button at the top of the page.
    For example:
    Master Report A contains a table with two columns, with the first column linked to a Detail Report
    ColA / ColB
    Clicking on ColA passes ColB to the Detail Report. The Detail report uses the bind variable to run a SQL Query.
    If two rows are in the Master Report
    A1 / B1
    A2 / B2
    Clicking A1 creates a correct URL and Detail Report using B1
    Going back to the Master Report and Clicking A2 quickly shows a Detail Report with B1. Using the Refresh Report button generates a Detail Report with B2. Note that the HTTP GET URL is proper and shows B2 in the second parameter.
    Is it pretty standard practice for a GC Administrator to hit the Refresh button on a report?
    Edited by: user11113565 on Dec 15, 2009 9:21 AM

    I'm not sure what you mean by via "the WebCache".
    I am going from browser directly to the management system with nothing in between (nothing but net).
    This does appear to be a framework problem. I've tried several different approaches. I am currently moving to hand generate the URLs to avoid this problem. I will check back if it works. The good thing is that I do not appear to require the reportId to build the URL.
    The goal is to insert event=refresh into the URL GET parameters ... hacking this into the bind parameters didn't work as the framework escapes the URL so the & gets turned into an innocuous escaped parameter.
    Paul

  • Bad bind var compile time err in OracleSpreadTable ActiveX

    I'm interested to learn the implementation procedures for using
    ActiveX into Forms 6i applications. How to do I go about
    OracleSpreadTable? I have given it a try; but, found some bad bind
    variable error while tried to compile.
    Steps that I followed:
    1) A database block was created based of EMP table
    2) Each item of the EMP block was changed to ActiveX
    3) Also in Layout wizzard # of row(s) to be shown = 1 was chosen
    4*) Each item (ActiveX) of the EMP block were selected to view their
    property and respectively OLE informaion was changed to OracleSpreadTable
    * Alternatively, I haved tried by right clicking the ActiveX item and
    inserting OracleSpreadTable object for each of them.
    5) Then by selecting the ActiveX items one-by-one from "Program"
    pull-down menu "Import OLE ..." was chose and all the attributes and
    methods were taken.
    On compile I got bad-bind variable ... :-(
    Please help me out: How to incorporate ActiveX in Forms 6i
    Application !?
    I 'll appreciate your cooperation.
    SAJJAD
    [email protected]
    [email protected]

    I'm interested to learn the implementation procedures for using
    ActiveX into Forms 6i applications. How to do I go about
    OracleSpreadTable? I have given it a try; but, found some bad bind
    variable error while tried to compile.
    Steps that I followed:
    1) A database block was created based of EMP table
    2) Each item of the EMP block was changed to ActiveX
    3) Also in Layout wizzard # of row(s) to be shown = 1 was chosen
    4*) Each item (ActiveX) of the EMP block were selected to view their
    property and respectively OLE informaion was changed to OracleSpreadTable
    * Alternatively, I haved tried by right clicking the ActiveX item and
    inserting OracleSpreadTable object for each of them.
    5) Then by selecting the ActiveX items one-by-one from "Program"
    pull-down menu "Import OLE ..." was chose and all the attributes and
    methods were taken.
    On compile I got bad-bind variable ... :-(
    Please help me out: How to incorporate ActiveX in Forms 6i
    Application !?
    I 'll appreciate your cooperation.
    SAJJAD
    [email protected]
    [email protected]

  • ViewLink accessor attribute NULL when VO has bind vars

    Hi! I noticed that a ViewLink accessor attribute returns a NullPointer when the ViewObject SQL has a bind variable. i have a data model with Dept and Employee ViewObjects that is connected via viewlink.
    I inserted a bind parameter :pDept and added on the whereclause "DeptNo = :pDept" to filter the employee returned based on Department. I then created a new Dept Row and a new employee on the same transaction (no commiting yet). When I got a reference to the viewLink accessor on the EmployeeViewRowImpl, i got a null reference when i tried to reference the viewLInk accessor for the department view:
    //code snippet inside EmployeeViewRowImpl
    void setAnAttribute(Object value) {
       Row row = getDeptView(); //returns null
    }I notice that when I removed the bind variables and the where clause, I get the correct ViewLink accessor.
    Is this expected behavior? if this is a bug, how can i get around this problem?

    hi anton.
    Maybe this is also related to your issue:
    "Difference Between View Link Attribute and View Link Instance in Data Model"
    http://radio.weblogs.com/0118231/stories/2004/11/08/differenceBetweenViewLinkAttributeAndViewLinkInstanceInDataModel.html
    success
    Jan Vervecken

  • Custom Titles for charts with Bind vars

    I have seen several posts on tnese pages regarding doing this very thing for a report. I have done this and it worked fine. But doing the same thing on a chart doesn't . Why?
    I have tried many things making use of wwpro_api_parameters functions. Nothing has so far worked. Can anyone please help.
    null

    use the colour wheel to obtain million + colours:     Inspector > Format > Style > Fill

  • Binding node value from public var

    Hi,
    I am developing an interface between an axis web service and flex.
    I must create a custom soap message, so I have define:
    CDATA
    [Bindable] public var name:String = "PRUEBAS";
        <mx:request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:loc="http://XXXXXXXXX/"
                  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                       format="xml">
             <loc:DarWeb soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
             <in0 xsi:type="loc:Elem" xmlns:dat="http://XXXXXX">
                <original xsi:type="xsd:string">{name}</original> IT DOES NOT TAKE THE VALUE OF THE BINDING VAR
           </in0>
    Please, someone who knows how to get the value of the var?
    PD: In compilation time I have the next warning:  "data binding will not be able to detect assignments to ..."
    Thanks in advance
    Fran

    Thanks for your reply williams. I will try to explain better.
    I have an action script class called Name with the next attribs:
      public class Name
             [Bindable] public var name:String;
             [Bindable] public var ape1:String;
             [Bindable] public var cp:String;
          public function Name()
                      //nothing initialize   
    In my mxml I have
    <mx:Script>
        <![CDATA[
        [Bindable] public var nombre:Name = new Name();
        ]]>
    </mx:Script>
    And the last code that are involve in my problem is the next one:
    <mx:WebService id="webService" wsdl="XXXX (local wsdl)" showBusyCursor="true">
        <mx:operation name="getNames"
                    resultFormat="e4x"
                    result="handleResponse(event);"
                    fault="handleFault(event);">
              <mx:request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:name="http://XXXXXXX"
                  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                       format="xml">
                  <name:getNames soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                       <in1 xsi:type="name:Name" xmlns:name="http://XXXXXX">
                          <name xsi:type="xsd:string"> {nombre.name}</name><!-- value from class-->
                          <ape1 xsi:type="xsd:string">{nombre.ape1}</ape1><!-- value from class-->
                          <cp xsi:type="xsd:string">{nombre.cp}</cp><!-- value from class-->
                       </in1>
               </name:getNames>               
             </mx:request>
              </mx:operation>
        </mx:WebService>
    I can not retrieve class attribute´s values, so the xml nodes are null.
    Thanks a lot for those who reply.
    Fran

  • SQL IN clause with Bind parameter?

    Hi
    I have a simple task that hasn't been so simple to figure out. I want to allow a user to search for one or more comma-separated values in a simple JClient ADF app. Is there a way to use a SQL IN clause with a single bind variable? e.g. SELECT TITLE FROM CITATION WHERE ID IN (:0)
    When I pass a single value it works fine but a comma separated list doesn't.
    Thanks
    John

    Update: I wanted to combine the techniques found in two of Steve Muench's articles -
    1) Providing Default Values for View Object Bind Variables (so I could display an ADF-bound JPanel with defaults)
    http://radio.weblogs.com/0118231/stories/2004/10/07/providingDefaultValuesForViewObjectBindVariables.html
    2) Array of String Domain Example (so a user could enter one or more comma-separated values into a text box for DB searches)
    http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html
    I learned some helpful stuff about the framework but spent lots of time banging my head against the wall because the two examples wouldn't work when directly combined. To best understand this, be sure to study Steve's examples above.
    In example 1 Steve passes an array of objects (Object[] DEFAULT_VALUES) to the ViewObject's where clause using the setWhereClauseParams(Object[] values). However, in example 2 he creates an Oracle Array which contains an Oracle ArrayDescriptor, Connection, and array of values to pass to the "IN" bind variable. Also, example 1 allows for multiple bind vars to be included whereas example 2 allows for an array of data to be passed to a single bind var. Even though my code provides an array to a single bind var (per ex. 2) it should still allow for the passage of multiple bind vars with minimal code modification.
    Code from Steve's example 1 was copied into my EmpView ViewObject but certain modifications were necessary:
    1) Change the ViewObject's DEFAULT_VALUES from Object[] to String[].
    2) Modify the executeQueryForCollection() method in the ViewObject to call a function which will set the bind variables as Oracle Arrays (effectively converting the "params" data type from that of String[] to Oracle Array[])
    3) Create a setManagerID(String[]) method in the EmpView object and expose it to the client.
    (there are a number of others so it's best for you to go through the code and compare)
    I finally got it working so I'm attaching the code, however beware - I'm new to this so there may be other, better ways to go about it. Also, there are no framework bind vars so that section of code is never executed...it compiles but may fail at run time.
    In order for this to work I suggest you use JDev to re-create the EmpView and Panel1 objects. This will ensure that the necessary ADF framework components are generated. Once complete, then copy in the code provided.
    *File: EmpViewImpl.java
    *Created as Read-Only access view object with the
    *query:
    *select manager_id, last_name from hr.employees
    *where manager_id IN
    *(select * from TABLE(CAST(:0 as TABLE_OF_VARCHAR)))
    *order by manager_id
    package model;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    import oracle.jbo.domain.Array;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.sql.ArrayDescriptor;
    // --- File generated by Oracle ADF Business Components Design Time.
    // --- Custom code may be added to this class.
    // --- Warning: Do not modify method signatures of generated methods.
    public class EmpViewImpl extends ViewObjectImpl implements model.common.EmpView
    private ArrayDescriptor descriptor;
    private final static String[] DEFAULT_VALUES_STRING = new String[]{"100"};
    private final static int NUM_DEFAULT_VALUES = DEFAULT_VALUES_STRING.length;
    * This is the default constructor (do not remove)
    public EmpViewImpl()
    protected void executeQueryForCollection (Object qc, Object[] params, int numUserParams)
    Object pars[] = null;
    // Bind default variables only if none have been provided by the user
    if (numUserParams == 0)
    numUserParams = NUM_DEFAULT_VALUES;
    int numFwkSuppliedBindVals = (params != null) ? params.length : 0;
    if (numFwkSuppliedBindVals > 0)
    // Allocate a new Object[] array with enough room for both user- and framework-supplied vars
    Object[] newBinds = new Object[numFwkSuppliedBindVals + numUserParams];
    // Copy the framework-supplied bind variables into a new Object[] array
    // leaving enough slots at the beginning for the user-supplied vars
    System.arraycopy(params, 0, newBinds, numUserParams, numFwkSuppliedBindVals);
    // Now copy in the user-supplied vars to the beginning of the array
    System.arraycopy(DEFAULT_VALUES_STRING, 0, newBinds, 0, numUserParams);
    params = newBinds;
    } else
    params = DEFAULT_VALUES_STRING;
    // We have to call this method to convert the default values into the proper Oracle Array expected by the query.
    // If you set a debugger breakpoint at this line you can see that the "params" data type changes from String[] to Object[]
    setWhereClauseParamsToDefaultValues();
    // Now retrieve the params of the new data type
    params = this.getWhereClauseParams();
    super.executeQueryForCollection(qc, params, numUserParams);
    private void setWhereClauseParamsToDefaultValues()
    this.setManagerID(DEFAULT_VALUES_STRING);
    private Connection getCurrentConnection() throws SQLException
    // Create a bogus statement so that we can access our current connection
    // JBD note - Does this get run each time??
    PreparedStatement st = getDBTransaction().createPreparedStatement("commit", 1);
    Connection conn = st.getConnection();
    st.close();
    return conn;
    private synchronized void setupDescriptor(Connection conn) throws SQLException
    descriptor = new ArrayDescriptor("TABLE_OF_VARCHAR", conn);
    * setManagerID
    * Exposed to client to accept an array of values (presumably passed in by user-entry into text box
    * @param aryMan
    public void setManagerID(String[] aryMan)
    Array arr = null;
    try
    // Find the connection
    Connection conn = getCurrentConnection();
    //Create the ArrayDescriptor by looking for our custom data type in our connected DB
    if(descriptor == null)
    setupDescriptor(conn);
    // Create the Oracle Array by passing in the descriptor, connection, and object array of data
    arr = new Array(descriptor, conn, aryMan);
    } catch (SQLException se)
    System.out.println("SQL Exception: " + se.getMessage());
    // Now we can set the WHERE clause parameter bind variable (index = 0) to the Oracle Array
    if (arr != null) setWhereClauseParam(0, arr);
    * FILE: Panel1.java
    * Created as an empty panel. Then a JTextField, a
    * JButton, and an EmpView1 table were dragged on.
    * A custom actionPerformed method was created for the
    * JButton which grabs the data from the text box.
    * The user can enter either a single manager id or
    * multiple, comma-separated ids.
    * All code in this class was created by JDev except
    * for the Jbutton action
    package view;
    import java.awt.*;
    import javax.swing.*;
    import model.common.*;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.SQLStmtException;
    import oracle.jbo.uicli.jui.*;
    import oracle.jbo.uicli.controls.*;
    import oracle.jbo.uicli.binding.*;
    import oracle.jdeveloper.layout.*;
    import oracle.adf.model.*;
    import oracle.adf.model.binding.*;
    import java.util.ArrayList;
    import oracle.jdeveloper.layout.VerticalFlowLayout;
    import javax.swing.JTextField;
    import javax.swing.JButton;
    import javax.swing.JTable;
    import javax.swing.table.TableModel;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    public class Panel1 extends JPanel implements JUPanel
    * NOTE: You need to have previous created the Oracle8 type named
    * ==== TABLE_OF_VARCHAR by doing the following at the SQL*Plus
    * command prompt:
    * create type table_of_varchar as table of varchar2(20)
    // Panel binding definition used by design time
    private JUPanelBinding panelBinding = new JUPanelBinding("Panel1UIModel");
    private VerticalFlowLayout verticalFlowLayout1 = new VerticalFlowLayout();
    private JTextField jTextField1 = new JTextField();
    private JButton jButton1 = new JButton();
    private JTable jTable1 = new JTable();
    * The default constructor for panel
    public Panel1()
    * the JbInit method
    public void jbInit() throws Exception
    this.setLayout(verticalFlowLayout1);
    jTextField1.setText("jTextField1");
    jButton1.setText("jButton1");
    jButton1.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    jButton1_actionPerformed(e);
    this.add(jTextField1, null);
    this.add(jButton1, null);
    this.add(jTable1, null);
    jTable1.setModel((TableModel)panelBinding.bindUIControl("EmpView1", jTable1));
    public static void main(String [] args)
    try
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    catch(Exception exemp)
    exemp.printStackTrace();
    Panel1 panel = new Panel1();
    panel.setBindingContext(JUTestFrame.startTestFrame("DataBindings.cpx", "null", panel, panel.getPanelBinding(), new Dimension(400, 300)));
    panel.revalidate();
    * JUPanel implementation
    public JUPanelBinding getPanelBinding()
    return panelBinding;
    private void unRegisterProjectGlobalVariables(BindingContext bindCtx)
    JUUtil.unRegisterNavigationBarInterface(panelBinding, bindCtx);
    private void registerProjectGlobalVariables(BindingContext bindCtx)
    JUUtil.registerNavigationBarInterface(panelBinding, bindCtx);
    public void setBindingContext(BindingContext bindCtx)
    if (panelBinding.getPanel() == null)
    panelBinding = panelBinding.setup(bindCtx, this);
    registerProjectGlobalVariables(bindCtx);
    panelBinding.refreshControl();
    try
    jbInit();
    panelBinding.refreshControl();
    catch(Exception ex)
    panelBinding.reportException(ex);
    private void jButton1_actionPerformed(ActionEvent e)
    // Get the user-supplied values
    String txt = jTextField1.getText();
    String[] mIds = txt.split(",");
    // Now trim
    for (int i=0; i<mIds.length; i++)
    mIds[i] = mIds.trim();
    ApplicationModule am = (ApplicationModule)panelBinding.getDataControl().getDataProvider();
    EmpView vo = (EmpView)am.findViewObject("EmpView1");
    vo.setManagerID(mIds);
    try
    vo.executeQuery();
    } catch (SQLStmtException s)
    System.out.println("Query failed: " + s.getMessage());

  • JBO-27122:SQL error during statement preparation + ORA-01006:bind variable not exists

    (1) I have built a BC4J View called CallFunctionView which acts as a view i used to call existing PL/SQL functions. My implementation servlet code is presented with the following structure:
    public class MyServlet extends HttpServlet {
    // Get vector element to perform validation for rule 1 and rule 2
    for (int i = 0; i < MyVector.size(); i++) {
    MyVectorRow MyRow = (MyVectorRow) MyVector.elementAt(i);
    MyRow.checkRule1(am, i);
    MyRow.checkRule2(am, i);
    (2) Both checkRule1 and checkRule2 will call the ViewObject CallFunctionView. Related codes for checkRule1 and checkRule2 are listed as follows:
    public void checkRule1(ApplicationModule am, int intRowIndex)
    throws JboException, Exception {
    ViewCdCallFunctionImpl vo = (CallFunctionViewImpl) am.findViewObject("CallFunctionView");
    if (vo == null) {             
    throw new JboException("View Object is null!");
    vo.setQuery("SELECT PKG1.MyFunctionOne(?,?,?,?) FROM DUAL");
    vo.setWhereClauseParam(0, param1); // param1 is string
    vo.setWhereClauseParam(1, param2); // param2 is string
    vo.setWhereClauseParam(2, param3); // param3 is String.valueOf(int)
    vo.setWhereClauseParam(3, param4)); // param4 is String.value Of(int)
    vo.executeQuery(); <- Point of exit where my mentioned error occurs at the second loop
    public void checkRule2(ApplicationModule am, int intRowIndex)
    throws JboException, Exception {
    ViewCdCallFunctionImpl vo = (CallFunctionViewImpl) am.findViewObject("CallFunctionView");
    if (vo == null) {             
    throw new JboException("View Object is null!");
    vo.setQuery("SELECT PKG2.MyFunctionTwo(?,?,?,?) FROM DUAL");
    vo.setWhereClauseParam(0, param1); // param1 is string
    vo.setWhereClauseParam(1, param2); // param2 is string
    vo.setWhereClauseParam(2, param3); // param3 is String.valueOf(int)
    vo.setWhereClauseParam(3, param4)); // param3 is String.valueOf(int)
    vo.setWhereClauseParam(4, (blnYes)?"Y":null);
    vo.setWhereClauseParam(5, (blnYes)?"Y":null));
    vo.executeQuery();
    (3)The called functions are from different package and with different parameters. For the loop i = 0, no error occurs and both functions generates expected result. For execution of the first function in the second loop (when i = 1), error occurs with the following messages(JBO-27122: SQL error during statement preparation. + java.sql.SQLException: ORA-01006: bind variable does not exist):
    oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT PKG1.MyFunctionOne(?,?,?,?) FROM DUAL
         void oracle.jbo.server.QueryCollection.executeQuery(java.lang.Object[], int)
         void oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(java.lang.Object, java.lang.Object[], int)
         void oracle.jbo.server.ViewRowSetImpl.execute(boolean, boolean)
         void oracle.jbo.server.ViewRowSetImpl.executeQuery()
         void oracle.jbo.server.ViewObjectImpl.executeQuery()
         void MyPkg.objects.MyVectorRow.checkRule1(oracle.jbo.ApplicationModule, int)
         void MyPkg.servlet.MyServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
         void com.evermind.util.ThreadPoolThread.run()
    ## Detail 0 ##
    java.sql.SQLException: ORA-01006: bind variable does not exist
         void oracle.jdbc.dbaccess.DBError.throwSqlException(java.lang.String, java.lang.String, int)
         void oracle.jdbc.ttc7.TTIoer.processError()
         void oracle.jdbc.ttc7.Oall7.receive()
         void oracle.jdbc.ttc7.TTC7Protocol.doOall7(byte, byte, int, byte[], oracle.jdbc.dbaccess.DBType[], oracle.jdbc.dbaccess.DBData[], int, oracle.jdbc.dbaccess.DBType[], oracle.jdbc.dbaccess.DBData[], int)
         int oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(oracle.jdbc.dbaccess.DBStatement, byte, byte[], oracle.jdbc.dbaccess.DBDataSet, int, oracle.jdbc.dbaccess.DBDataSet, int)
         void oracle.jdbc.driver.OracleStatement.doExecuteQuery()
         void oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout()
         int oracle.jdbc.driver.OraclePreparedStatement.executeUpdate()
         java.sql.ResultSet oracle.jdbc.driver.OraclePreparedStatement.executeQuery()
         void oracle.jbo.server.QueryCollection.executeQuery(java.lang.Object[], int)
         void oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(java.lang.Object, java.lang.Object[], int)
         void oracle.jbo.server.ViewRowSetImpl.execute(boolean, boolean)
         void oracle.jbo.server.ViewRowSetImpl.executeQuery()
         void oracle.jbo.server.ViewObjectImpl.executeQuery()
         void MyPkg.objects.MyVectorRow.checkRule1(oracle.jbo.ApplicationModule, int)
         void MyPkg.servlet.MyServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
         void com.evermind.util.ThreadPoolThread.run()
    I have tried commented either MyRow.checkRule1 or MyRow.checkRule2 for execution. No error occurs for that. The problem occurs when i put the two together in a loop ... the parameter number for Pkg1.MyFunctionOne is less than Pkg2.MyFunctionTwo, which corresponds to the error message 'Bind variable does not exist' ... any cache for calling the function that causes the error at running the vo.executeQuery statement?
    Question: Does anyone has any ideas about the error origin and solution? (It is very important to me because i still have several check rules in addition to those mentioned 2 rules.)
    Thanks for replying!

    Oic ... thanks for your help, but i find a strange thing. No error message is prompted when i break the loop as follows:
    // Get vector element to perform validation for rule 1 and rule 2
    for (int i = 0; i < MyVector.size(); i++) {
    MyVectorRow MyRow = (MyVectorRow) MyVector.elementAt(i);
    MyRow.checkRule1(am, i);
    // Get vector element to perform validation for rule 1 and rule 2
    for (int i = 0; i < MyVector.size(); i++) {
    MyVectorRow MyRow = (MyVectorRow) MyVector.elementAt(i);
    MyRow.checkRule2(am, i);
    It works, but quite strange ... is it a bug for calling the interface setWhereClauseParam(int, object)? As long as all the bind variables have value (your bind-var array is filled perhaps due to previous setWhereClauseParam, the query will work. What's critical is you get the right query every time :)

Maybe you are looking for