Variable binding is used twice

Hi all

Using Jdeveloper 11.1.1.3.0

We have a relationship simple master detail between 2 displays based on a query.

During execution of the AM Tester, we see the following in the log:


[code]

[2557] SELECT * FROM (SELECT ID, RECUPERATION_ID FROM tablex WHERE PERSON_LANGUAGE =: Language_bvar) QRSLT WHERE RECUPERATION_ID =: Bind_Id AND RECUPERATION_ID =: Bind_Id

...

[2560] link 'Language_bvar' param: NL

[2561] link 'Bind_Id' param: 981

[2562] link 'Bind_Id' param: 921

[/ code]

2 things to notice:

  1. You see that the bind_id variable is used twice in the where clause
  2. The bind_id is declared twice with different values

What is to decide for the bind_id variables to create?

How is it possible that the values are different?

Thanks in advance for any ideas.

Filip Huysmans

I could solve the problem by removing the use of viewlink in the model of the am and then re-create it with a completely different name.

After comparing the old to the new situation, I can only find name changes.

HTH for someone else.

Filip

Tags: Java

Similar Questions

  • How can I pass a value to a variable binding in a report query?

    I did a query of report to print a PDF report, with a dinamyc source query that has a connection variable, like this:

    SELECT EMPNO, EMPNAME, EMPDEPT

    FROM EMP

    WHERE EMPNO =: PARAMETER;

    I want to call the report print directly from a page, by using the url print showed by apex:

    f? p = & APP_ID.:0 : & SESSION. : PRINT_REPORT = MYREPORT

    How can I pass the value of the variable binding: PARAMETER using this URL?

    I don't think you can use the url parameter passes in a report query.

    the binding variable: PARAMETER must be a page element or an element of the application.

    use the "include session information and application" in the defination of report query to bind the value when the report is run

  • How many times can I use a variable binding in a query of the VO?

    Is it possible that I can use a variable binding in a query of VO just once?

    I test a query that keeps throwing the Houston-27122 error by pressing the application module tester. I tried to limit the problem to the simplest possible case, and it seems that the error is caused by the fact that I use the same variable bind two or more times.

    When the query looks like this:

    query1.png

    I have run, enter 'x' and it returns me the result.

    When I change to:

    query2.png

    I have run, enter the value

    param.png

    and immediately get the error

    error.png

    The same thing in sqlplus runs without problem:

    sqlplus.png

    My version of JDev is build JDEVADF_11.1.1.9.0_GENERIC_150314.0718.6673

    Please, advise.

    P. S. where can I find documentation queries are supported in your? In particular, I'm interested if I can use WITH the clause. There seems to be some confusion on this matter (see, for example, Oracle SQL WITH clause support - JDeveloper and ADF)

    Thank you.

    It depends on:

    Open your VO in JDev and go the the query page.

    In the lower part, there is a drop down 'link type', it is usually set to "JDBC-positional. In this case, you will need to provide the bind value for each occurrence of the variable binding separately.

    You could change that to "named" (don't remember the exact name). But beware, this will also affect all relatioships master retail to others your. I think that this is not a good idea to change the style of binding to a single VO.

    Good bye

    DPT

  • Bind Variables out of use

    I don't know where to post this, please point me in the right direction if necessary. It seems that binds the variables in the order that they appear in the SQL statement works very well, but bind them down causes the statement to be poorly executed. Here is the result on my machine, Win 7 Pro, JDK 1.7.0_21 against Oracle 11.2.0.3 on Linux 64.

    Create table test
    Insertion of temporary data
    Display all data
    10 50 Red
    20 40 Green
    30 30 Blue
    10 40 Orange
    20 50 yellow
    70 rose 10
    Selection of A = 10 and B = 50 in the order
    10 50 Red
    Selection in the reverse of A = 10 and B = 50
    Table of drop test

    Here's the code that produced these results. The difference between the declarations of the first and the second selection is simply the order, that the variables are related. Am I doing this wrong?

    Import oracle.jdbc.OracleDriver;

    to import java.sql.CallableStatement;
    import java.sql.Connection;
    to import java.sql.DriverManager;
    import java.sql.ResultSet;

    public class RunTests {}
    Private Sub log (String s) {}
    System.out.println (s);
    }

    Private Sub log (row of the ResultSet) throws Exception {}
    log (Row.GetString ("a") + "\t" + row.getString ('b') + '\t' + row.getString ("c"));
    }

    Private Sub start (String [] args) throws Exception {}
    DriverManager.registerDriver new (OracleDriver());
    Connection c is DriverManager.getConnection ("jdbc:oracle:thin:@someserver:1521:sid", "user", "pass");.

    Log ('Creating test table');
    CallableStatement cs = c.prepareCall ("create table eric_example (number, number of b, c varchar2 (30))");
    DSI Execute();
    DSI Close();

    Journal ("insertion of temporary data");
    CS = c.prepareCall ("insert into eric_example values (:,: b: c) '");
    cs.setInt (": a", 10);
    cs.setInt (": b", 50);
    cs.setString (": c", "Red");
    cs.executeUpdate ();

    cs.setInt (": a", 20);
    cs.setInt (": b", 40);
    cs.setString (": c", "Green");
    cs.executeUpdate ();

    cs.setInt (": a", 30);
    cs.setInt (": b", 30);
    cs.setString (": c", "Blue");
    cs.executeUpdate ();

    cs.setInt (": a", 10);
    cs.setInt (": b", 40);
    cs.setString (": c", "Orange");
    cs.executeUpdate ();

    cs.setInt (": a", 20);
    cs.setInt (": b", 50);
    cs.setString (": c", "Yellow");
    cs.executeUpdate ();

    cs.setInt (": a", 70);
    cs.setInt (": b", 10);
    cs.setString (": c", "Pink");
    cs.executeUpdate ();
    DSI Close();

    Log ("indicating all data");
    CS = c.prepareCall ("select * from eric_example");
    ResultSet rs = cs.executeQuery ();
    While (RS. Next {}
    log (RS);
    }
    RS. Close();
    DSI Close();

    Log ('Selecting A = 10 and B = 50 in the order");
    CS = c.prepareCall ("select * from eric_example where a =: a and b =: b");
    cs.setInt ("a", 10);
    cs.setInt ("b", 50);
    RS = cs.executeQuery ();
    While (RS. Next {}
    log (RS);
    }
    RS. Close();
    DSI Close();

    Journal ("selection A = 10 and B = 50 in reverse");
    CS = c.prepareCall ("select * from eric_example where a =: a and b =: b");
    cs.setInt ("b", 50);
    cs.setInt ("a", 10);
    RS = cs.executeQuery ();
    While (RS. Next {}
    log (RS);
    }
    RS. Close();
    DSI Close();

    Log ("table Dropping test");
    CS = c.prepareCall ("drop table eric_example");
    DSI Execute();
    DSI Close();

    c.Close ();
    }

    Public Shared Sub main (String [] args) {}
    RunTests runTests = new RunTests();
    try {}
    runTests.start (args);
    } catch (Exception e) {}
    e.printStackTrace ();
    System.Exit (1);
    }
    }

    }

    >
    I don't know where to post this, please point me in the right direction if necessary. It seems that binds the variables in the order that they appear in the SQL statement works very well, but bind them down causes the statement to be poorly executed. Here is the result on my machine, Win 7 Pro, JDK 1.7.0_21 against Oracle 11.2.0.3 on Linux 64.
    >
    Although what do you expect to link which includes a colon in the name?

    cs.setInt(":a", 10);
    

    And the code like this

    cs.setInt("a", 10);
    

    is NOT supported. You can not bind by name using the setXXX methods.

    Change your code to use syntax supported, and you shouldn't have a problem.

    cs = c.prepareCall("select * from eric_example where a = :1 and b = :2");
    cs.setInt(1, 10);
    cs.setInt(2, 50);
    

    See "Binding parameters named" in the Guide of Dev JDBC
    http://docs.Oracle.com/CD/B28359_01/Java.111/b31224/apxref.htm#BABEJDBH
    >
    Binding parameters named

    Binding by name is not supported when using the setXXX methods. In certain circumstances, previous versions of the Oracle JDBC drivers have allowed binding variables name declaration when using the setXXX methods. In the following statement, the variable named EmpId is linked to the whole 314159.

    P = conn.prepareStatement PreparedStatement
    ("" SELECT name FROM emp WHERE id =: EmpId "");
    p.setInt (1, 314159);

    This ability to set by name using the setXXX methods is not part of the specification, JDBC and Oracle does not support. JDBC drivers can throw an SQLException exception or produce unexpected results. From JDBC Oracle Database 10 g drivers, connection by name is supported by using the setXXXAtName methods.
    >
    You can use one of these 'previous versions' driver which seem to confirm the connection by name but these links are NOT supported, so you should not try to use them.

    There is no work around. Replace the names of variables bind with an exclamation mark.

  • Execution plan will change if I use the variable binding instead of the literal value?

    Hi guys,.

    Suppose I have a select "... Of... WHERE ID = 2 and... "if I go to use the variable binding instead of the literal value 2," SELECT... " Of... WHERE ID =: p_id and... ", the execution plan change?
    I test multiple statements, the plan does not change, but I don't know if it would even as well as in some other cases.
    Someone at - it ideas?

    Thank you very much.

    Anneso wrote:
    Hi, sorry for the unclear post, it's 11 GR 2.

    As Sybrand already mentioned, there are a lot of change that came in the implementation of the bind variable in some versions of Oracle db. Since you're on 112, it is still true with the introduction of Adaptive Cursor Sharing . Please have a read on it since the post below written by the development of Oracle optimizer group.
    http://blogs.Oracle.com/optimizer/entry/why_are_there_more_cursors_in_11g_for_my_query_containing_bind_variables_1

    Aman...

  • Correct way to use Bind variables when you use an interface to MS SQL Server

    Hey,.
    I have some difficulty to find how to use bind variables in a view, when you use an interface to MS SQL Server. For some reason when I use an ApplicationModule who has a library of MS SQL Server JDBC loaded and I try to click on OK when you change the following query:

    SELECT kit_status, component_id
    OF numbered_inv
    WHERE trialname =: 1

    I get an error stating that ' SQL Query Error Message incorrect syntax near ':'. JDeveloper is compatible with SQL server for bind variable as this query works fine if I replace the: 1 with a Word to say "Test test".

    Thanks in advance

    Edited by: NullCheck December 15, 2010 14:06

    Use positional JDBC Style Binding to bind variables
    Try to use? Instead of:
    As shown here:
    http://www.Oracle.com/technetwork/developer-tools/jdev/multidatabaseapp-085183.html

  • How to use a variable binding in an IN clause

    I'm trying to use a variable binding in an IN clause where the column is a type varchar2. Something like:
    select *
    from test
    where test_column in (:bindVariable)
    I tried the assignment of channels bind variable separated by commas (for example, test, test, test) and separated by commas strings with quotation marks (for example. 'test', 'test', 'test'). None of these work. Anyone know the correct way to do this?

    Thanks in advance.

    http://tkyte.blogspot.com/2006/06/varying-in-lists.html

    Presents many options.

  • Use sessionScope as the value of the Variable binding

    Dear all,

    I have a variable in sessionScope, and I want to use it as a condition of application of a ViewObject.

    I found a thread talking about, there's only one: (Re: set the value in the global variable. )
    How to use the value in the scope of session groovy script?

    Model project:
    Set variable in the scope of the session:
    ADFContext.getCurrent () .getSessionScope () .put ("Empno", empno);

    Getting value of session scope:
    Object empno is ADFContext.getCurrent () .getSessionScope () .get ("Empno");.

    ViewProject:
    Set variable in the scope of the session:
    FacesContext.getCurrentInstance () .getExternalContext () .getSessionMap () .put ("Empno", empno);

    Getting value of session scope:
    Object empno is FacesContext.getCurrentInstance () .getExternalContext () .getSessionMap () .get ("Empno");.

    Getting value of scope jspx page session
    #{sessionScope.Empno}

    Hi Samson,.

    Here are the groovy expression to access the value of the sessionscope:

    adf.context.sessionScope.role
    

    But, as the said John instead to access the session of the model can be a method of model (whether in AMImpl or voImpl) who takes the role as a parameter value and sets the value of the variable binding of the vo, then call this AM from the bean method passing the role value by getting the scope of the session.

    Jean Lou

  • Variable binding defined in LOV

    Hi, I use JDev 11.1.1.7

    I have a VO (FundingNameVO) which takes in bind variable.

    FundingNameVO is used as LOV in an another VO (ProjectVO) for a FundingName attribute.

    ProjectVO also has an attribute FundingSource has also a LOV.

    When FundingSource is selected, the value must be sent to the liaison FundingNameVO variable to determine the LOV to display for FundingName,

    How to pass the FundingSource value to the variable of FundingNameVO binding?

    Thank you.

    Hello

    If the value of the variable binding from attribute ProjectVO follow these steps:

    in tab display accessor is ProjectVO, you have added an instance of FundingNameVO, click the view accessor on Edition, then in the open Panel, you see the bind variable, set the value of the variable binding with the good ProjectVO attribute name

    If not check this: http://www.jobinesh.com/2011/03/initializing-bind-variables-in-query.html

    Kind regards

    Habib

  • The value of variable binding VO on page load by program

    Hello everyone!

    I use JDeveloper version 11.1.2.3.0

    I am currently trying to get the filtered data to a VO, based on a WHERE clause with a variable binding. This process must be done on the loading of the page. I have set this variable for liaison with the id of the logged in user (the part to get this id is already reached and used somewhere else). My current approach is to define a bean managed with scope pageFlow. Inside of this, I have a method in which I get the id and I put it as parameter. The code snippet:

          BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("getUserIdFromUsername"); //getUserIdFromUsername is a method defined in the AppModule and exposed in the client interface
           operationBinding.getParamsMap().put("username", getUserName());
          Object userID = operationBinding.execute();
            setUserId(Integer.parseInt(userID.toString()));
           System.out.println("THE USER ID IS: "+getUserId());
           BindingContainer bindings2 = getBindings();
           OperationBinding operationBinding2 = bindings.getOperationBinding("ExecuteWithParams");  // i've dragged and dropped the ExecuteWithParams operation into the page
           operationBinding2.getParamsMap().put("userId", getUserId());  // userId is the bind variable which i'm talking about
            Object result = operationBinding2.execute();
    
    
    

    Then I call this method on BeforePhase in the view of the page. It works, I get the filtered data and the println shows me the correct ID. The problem is that whenever I select a row in the table showing the data, the page seems to reload and it always reload the selection at the forefront.

    What I am doing wrong? Maybe this isn't the right approach, that I saw a few other posts on this topic, but they are not very clear to me.

    Please advice

    OK, that's what I did. I created the method to set the value of the variable to bind to the query of the VO in the AppModule instead of inside the bean (this method also runs the query) and client presentation to the interface. After I have created the method call in the section of links the pagedef (where he gets the value of the id of the bean in the original post), and followed Cvele_new_account suggestion, calling the method as follows:

    RefreshCondition = "#{! requestContext.postback and empty bindings.exceptionList}" / >

    Thank you for the help guys!
  • How not to display variable binding in the query ADF search panel?

    Hello, I use JDeveloper 11.1.2.3.0.

    I have a variable binding in my VO, (* required) that I use in the sql query. I put the value of this variable to link through the groovy expression so I don't have to manually put through my page. It works fine but the problem is that it appears in the query ADF Panel that I created in my page. To do this, I created a ViewCriteria and I've specified to display only 3 (other) fields for the simple search. Apart from the selected 3 variable bind shows here again because its value is set. I tried to remove the ' * required ' of the variable binding in the original Version, but in this case I have problems with my sql query.

    Does anyone know how this variable is not to display in the Panel request ADF?

    Thank you

    Has tried to define the binding to bee hidden variable?

    Controll tips, hint of display = hide

  • How to set the value of the variable bind in VO on page load?

    Hello, I use JDeveloper 11.1.2.3.0.

    I created a VO in my application that uses a variable binding in the where clause. I want to put the value of this variable on the loading of the page automatically.

    I read that I can do this through setNamedWhereClauseParam()... but I can't find out where and how to use it.

    Can anyone help please?

    You can put in different places:

    AppModuleImpl,

    ViewObjectImpl,

    ViewRowImpl

    Just him export the customer interface and use whenever you want

  • How to remove the variable created when using definedNamedWhereClauseParam()

    Hello

    My Jdev version 11.1.1.7.0.

    I'm Executive where clause programatically where I need to bind two bind parameters under certain conditions. Example, I have two bind variables X, Y.

    Here's the problem:

    Assume that the first time I'm setting one variable X, so I define X bind variable and execute the query.

    What second time I send only Y but not X. In this implementation of the scenario of VO throw an exception, given that the variable X is already created in the VO object and where clause does not have this setting.

    So how to remove variables created in the original Version all in definedNamedWhereClauseParam(). I need to erase what ever the previously created variable every time I execute method.

    I can make the similar functionlity using setWhereClauseParam (using literals). But I have a few technical restrictions for use.

    Could you please help me how to remove the variable before vo using definedNamedWhereClauseParam.

    Caused by: java.sql.SQLException: try to set a parameter name that does not intervene in the SQL: itemNumber
    at oracle.jdbc.driver.OraclePreparedStatement.setObjectAtName(OraclePreparedStatement.java:15969)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObjectAtName(OraclePreparedStatementWrapper.java:911)
    at weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_OraclePreparedStatementWrapper.setObjectAtName (unknown Source)
    at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:4669)
    at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3687)
    at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:22742)
    at oracle.jbo.server.QueryCollection.buildResultSet(QueryCollection.java:1298)
    ... more than 96



    Thank you.

    -Diette.

    Published by: Vidya Diette on February 28, 2013 08:43

    Hello

    You need access to the variable Manager. Order of reading in the JavaDocs:

    http://docs.Oracle.com/CD/E28389_01/apirefs.1111/e10653/Oracle/JBO/ViewObject.html--> http://docs.oracle.com/cd/E28389_01/apirefs.1111/e10653/oracle/jbo/VariableManagerOwnerBase.html#getVariableManager%28%29--> http://docs.oracle.com/cd/E28389_01/apirefs.1111/e10653/oracle/jbo/VariableValueManager.html--> http://docs.oracle.com/cd/E28389_01/apirefs.1111/e10653/oracle/jbo/VariableManager.html#removeVariable%28java.lang.String%29

    Frank

  • Definition of variables bind to VO JUnit test cases

    Hello

    I use Jdeveloper 11.1.2.2

    I have a problem when writing to VO to JUnit test case.
    For the Remove method in the Test case, I spent variables in the t by using a setWhereClause().
    Like this:
            view.setWhereClause(null);
           
            String whereClause = "location_id = '" + newUpdatedLocationId  + "' AND organization_id = '" +newOrganizationId + "'" ;
            view.setWhereClause(whereClause);
           
            view.executeQuery();
            
            while (view.hasNext()) {
                view.next();
                view.removeCurrentRow();
            }
           
            fixture1.getApplicationModule().getTransaction().commit();
    But he demonstrated a a mistake as the bind variables are not defined.

    So, how do I access variable Bind programmatically and set the values?

    Thank you
    Nigel.

    setNamedWhereClauseParam() is used to set the bind variables

  • Display Variable binding object, query, (Bean.attribute) HOW?

    Hi, I use an attribute of bean as a Bind Variable in a query to a display object.
    I have the following bean:
    package model;
    
    public class FalseBPM {//Simulate a BPM payload
        private String idDocIPM;
    
        public FalseBPM() {
            idDocIPM="5.IPM_016801";
        }
    
        public String getIdDocIPM() {
            return idDocIPM;
        }
    
        public void setIdDocIPM(String idDocIPM) {
            this.idDocIPM = idDocIPM;
        }
    }
    In a fragment of web page, I have an af:table of the DB (by datacontrol). It is necessary that the table load only the lines with the idDocIPM in his ID_DISTRIBUTION column. I did this:
    In my view, object-> query:
    SELECT IpmDistributionManual.ID_DISTRIBUTION, 
           IpmDistribucionManual.ID_BUSINESS, 
           IpmDistribucionManual.ID_CHANNEL, 
           IpmDistribucionManual.ID_ENTITY, 
           IpmDistribucionManual.VALUE
    FROM IPM_DISTRIBUTION_MANUAL IpmDistributionManual
    WHERE IpmDistributionManual.ID_DISTRIBUTION=:ID 
    In my display-> query object: - > variable binding:
    <Variable
        Name="ID"
        Kind="where"
        Type="java.lang.String"
        DefaultValue="#{falseBPM.idDocIPM}"/> //But I get an error in Literal or in Expression mode.
    How can I do this?

    Thanks in advance.

    Published by: Sarah on 28/10/2011 07:41

    Sarah,

    In your workflow, drag and drop the action 'run with the settings' for your view object (it is in the range of data control) on the workflow as a method call activity. Bind the parameter to the value of bean with EL (that you have tried to do in the VO itself - note that you can not use EL in the template like this project). Then, make sure the method call is wired to the top to run before your activity in the workflow view.

    John

Maybe you are looking for