[Solved] Named Bind Variables at Runtime - SQL WHERE clause issue

Hey 'all,
I've been having this issue today with a Search page using Named Bind Variables at Runtime for the search parameters for the WHERE clause in the view objects SQL.
I've got everything working except for a clearing method which I've created so that the user can clear the current WHERE clause from the SQL statment and set it as 1=2 (so that it doesn't do a blind query on load).
The method can clear and set the WHERE clause to 1=2 only when there is already one there.
Below are the methods: (located in my view object class)
public void findInvoiceById(Number invoiceId){
    setWhereClause("invoice_id = :P_INVOICE_ID");
    defineNamedWhereClauseParam("P_INVOICE_ID",null,null);
    setNamedWhereClauseParam("P_INVOICE_ID",invoiceId);
    executeQuery();
public void clearCriteria(){
    setWhereClause("1=2");
    removeNamedWhereClauseParam("P_INVOICE_ID");
    executeQuery();
}The error which I get is the following - this happens when the button is pressed twice in a row, or when no query has been passed previously.
1. JBO-29000: Unexpected exception caught: oracle.jbo.NoDefException, msg=JBO-25058: Definition P_INVOICE_ID of type Variable not found in SupplierInvoicesView1
2. JBO-25058: Definition P_INVOICE_ID of type Variable not found in SupplierInvoicesView1
Any help with this would be greatly appreciated!
Cheers,

Hi Bonnie,
we have it working ok, but still feel that there is room for improvement in the design.
For us the key factors are:
Pages based on the same view object that can be queried multiple ways.
We don't want to put design time bind variables in because it limits the use of the VO
We don't wan't multiple VO's with different where clauses.
The page is displaying the same table columns and fields, but the where clause must be dynamic.
We only want to query on the search field entered (some of our tables are massive)
TopLink named queries are really what we are after, but we don't want to forgo all the other ADF BC functionality. The only examples of ViewCriteria in the developer guide had literals in the where clause and no bind variables. The View Criteria may still be an option, but it appeared quite complex compaired to directly adding and removing bind variables at runtime.
a couple of footnotes:
the following methods are used to clear the runtime variables prior to reusing the VO (thanks to John Stegman for the pointer on the exception handler):
    public void clearBindVariable(String bindVariableName){
        try
            removeNamedWhereClauseParam(bindVariableName);
        catch (NoDefException e)
    public void clearBindVariables(){
        clearBindVariable("P_INVOICE_ID");
        clearBindVariable("P_INVOICE_NUM");
        clearBindVariable("P_SUPPLIER_NAME");
        clearBindVariable("P_INVOICE_DATE_FROM");
        clearBindVariable("P_INVOICE_DATE_TO");
        clearBindVariable("P_SUPPLIER_NUMBER");
    }We are using 1=1 and 1=2 in the where clause to supress blind querying. 1=2 is applied when ever we are not explicitely searching for something. We had a problem with using the refresh condition ${adfFacesContext.postback == true} which I posted about here:
executeQuery called twice using ${adfFacesContext.postback == true}
Would still gladly hear other ideas on a better reuse design.
regards,
Brenden

Similar Messages

  • How to populate bind variable in view objects where clause in ADF faces

    I've got a page with 2 input items.
    The user manually enters the first value.
    On the second input item I have created a LOV for the item which opens in a popup. How do I restrict the data returned in the LOV using the value entered in the first input item. I have created a bind variable and have included it in the where clause for the view object but how do I populated it.

    Here is an example:
    Using the HR schema with the EMPLOYEES and DEPARTMENTS tables.
    Example is using ADF BC and created an EMPLOYEES entity with an updateable view object for page,
    and created a DEPARTMENTS view as a lookup
    (SQL: select department_id, department_name from departments where department_name = :DeptName)
    1: add method to the backing bean to filter the LOV
    public void getTextValueToFilterLOV(ValueChangeEvent valueChangeEvent) {
    Object value_from_form = valueChangeEvent.getNewValue();
    FacesContext fctx = FacesContext.getCurrentInstance();
    Application fapp = fctx.getApplication();
    JUFormBinding formBinding = (JUFormBinding)fapp.createValueBinding("#{bindings}").getValue(fctx);
    DCIteratorBinding dcBinding = (DCIteratorBinding)formBinding.get("DeptLOVIterator");
    ViewObject vo = dcBinding.getViewObject();
    vo.setNamedWhereClauseParam("DeptName",value_from_form);
    vo.executeQuery();
    2. add valueChangeListener to the inputText on the page with an id and autoSubmit="true"
    <af:inputText value="#{bindings.LastName.inputValue}" label="#{bindings.LastName.label}" binding="#{backing_DeptForm.inputText3}"
    id="inputText3"
    autoSubmit="true"
    valueChangeListener="#{backing_DeptForm.getTextValueToFilterLOV}">
    </af:inputText>
    3. reference the LOV with the id name on the partialTriggers property
    <af:selectOneChoice value="#{bindings.EmployeesUpdView1DepartmentId.inputValue}"
    label="#{bindings.EmployeesUpdView1DepartmentId.label}" binding="#{backing_DeptForm.selectOneChoice1}"
    id="selectOneChoice1"
    partialTriggers="inputText3">
    <f:selectItems value="#{bindings.EmployeesUpdView1DepartmentId.items}"
    binding="#{backing_DeptForm.selectItems1}"
    id="selectItems1"/>
    </af:selectOneChoice>
    Summary:
    When you entered a text (LastName), that value is passed into the backing bean method.
    The Bean method code will find the LOV Iterator and put the value into the bind variable.
    Cheers,
    Jim

  • Date Effective SDO and named bind variable

    Hi.
    I have a problem with named bind variable in date effective ADF Business Component (:Bind_SysEffectiveDate).
    Service interface of my EmployeeHistorySDO has next methods:
    getEmployeeHistoryView1
    updateEmployeeHistoryView1
    findEmployeeHistoryView1
    createEmployeeHistoryView1
    deleteEmployeeHistoryView1
    If I invoke getEmployeeHistoryView1 method I'm getting next SQL statement:
    [332] EmployeeHistoryView1 ViewRowSetImpl.doSetWhereClause(-1, SysEffectiveDateBindVar, null)
    [333] EmployeeHistoryView1 ViewRowSetImpl.doSetWhereClause(-1, SysEffectiveDateBindVar, null)
    [334] Column count: 7
    [335] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.doSetWhereClause(-1, SysEffectiveDateBindVar, null)
    [336] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.setWhereClauseParams caused params changed
    [337] EmployeeHistoryView1 ViewRowSetImpl.doSetWhereClause(-1, SysEffectiveDateBindVar, null)
    [338] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.setWhereClauseParams caused params changed
    [339] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.setWhereClauseParams caused params changed
    [340] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.setWhereClauseParams caused params changed
    [341] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.doSetWhereClause(-1, SysEffectiveDateBindVar, null)
    [342] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.setNamedWhereClauseParam(SysEffectiveDateBindVar, null)
    [343] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.doSetWhereClause(-1, fbkKy__0, null)
    [344] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.setNamedWhereClauseParam(fbkKy__0, 3)
    [345] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.setNamedWhereClauseParam(SysEffectiveDateBindVar, 2010-10-01)
    [346] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.doSetWhereClause(-1, SysEffectiveDateBindVar, 2010-10-01)
    [347] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.doSetWhereClause(-1, fbkKy__0, 3)
    [348] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.execute caused params to be "un"changed
    [349] Column count: 7
    [350] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.doSetWhereClause(-1, SysEffectiveDateBindVar, 2010-10-01)
    [351] EmployeeHistoryView_0_findByKey_ ViewRowSetImpl.doSetWhereClause(-1, fbkKy__0, 3)
    [352] executeQueryForCollection ViewObject:EmployeeHistoryView_0_findByKey_, RowSet:EmployeeHistoryView_0_findByKey_
    [353] ViewObject: [com.test.sdo.dateeffective.employee.history.EmployeeHistoryView]EmplHistoryAppModule.EmployeeHistoryView_0_findByKey_ close prepared statements...
    [354] ViewObject: [com.test.sdo.dateeffective.employee.history.EmployeeHistoryView]EmplHistoryAppModule.EmployeeHistoryView_0_findByKey_ Created new QUERY statement
    [355] EmployeeHistoryView_0_findByKey_>#q computed SQLStmtBufLen: 403, actual=380, storing=410
    [356] SELECT EmployeeHistory.HISTORY_ID,         EmployeeHistory.POSITION,         EmployeeHistory.WAGE,         EmployeeHistory.EMPL_ID,         EmployeeHistory.START_DATE,         EmployeeHistory.END_DATE FROM EMPLOYEE_HISTORY EmployeeHistory WHERE (EmployeeHistory.HISTORY_ID = :fbkKy__0) AND (:SysEffectiveDateBindVar BETWEEN EmployeeHistory.START_DATE AND EmployeeHistory.END_DATE)
    [357] pStmt = conn.prepareStatement("SELECT EmployeeHistory.HISTORY_ID, EmployeeHistory.POSITION, EmployeeHistory.WAGE, EmployeeHistory.EMPL_ID, EmployeeHistory.START_DATE, EmployeeHistory.END_DATE FROM EMPLOYEE_HISTORY EmployeeHistory WHERE (EmployeeHistory.HISTORY_ID = :fbkKy__0) AND (:SysEffectiveDateBindVar BETWEEN EmployeeHistory.START_DATE AND EmployeeHistory.END_DATE)"); // JBO-JDBC-INTERACT
    [358] Bind params for ViewObject: [com.test.sdo.dateeffective.employee.history.EmployeeHistoryView]EmplHistoryAppModule.EmployeeHistoryView_0_findByKey_
    [359] Binding param "SysEffectiveDateBindVar": 2010-10-01
    [360] // ERROR: Unknown data type oracle.jbo.domain.Date // JBO-JDBC-INTERACT
    [361] pStmt.setObjectAtName(SysEffectiveDateBindVar, "2010-10-01"); // JBO-JDBC-INTERACT
    [362] Binding param "fbkKy__0": 3
    [363] // ERROR: Unknown data type oracle.jbo.domain.Number // JBO-JDBC-INTERACT
    [364] pStmt.setObjectAtName(fbkKy__0, "3"); // JBO-JDBC-INTERACT
    Environment successfully binds today date to :SysEffectiveDateBindVar.
    But if I try to invoke updateEmployeeHistoryView1 method environment binds already the variable that doesn't presents in SQL query, so I have an exception:
    [606] EmployeeHistoryView_1_findByKey_ ViewRowSetImpl.doSetWhereClause(-1, SysEffectiveDateBindVar, 2010-10-01)
    [607] EmployeeHistoryView_1_findByKey_ ViewRowSetImpl.doSetWhereClause(-1, Bind_SysEffectiveDate, 2010-10-01 00:00:00.0)
    [608] EmployeeHistoryView_1_findByKey_ ViewRowSetImpl.doSetWhereClause(-1, fbkKy__0, 3)
    [609] executeQueryForCollection ViewObject:EmployeeHistoryView_1_findByKey_, RowSet:EmployeeHistoryView_1_findByKey_
    [610] ViewObject: [com.test.sdo.dateeffective.employee.history.EmployeeHistoryView]EmplHistoryAppModule.EmployeeHistoryView_1_findByKey_ close prepared statements...
    [611] ViewObject: [com.test.sdo.dateeffective.employee.history.EmployeeHistoryView]EmplHistoryAppModule.EmployeeHistoryView_1_findByKey_ Created new QUERY statement
    [612] EmployeeHistoryView_1_findByKey_>#q computed SQLStmtBufLen: 403, actual=380, storing=410
    [613] SELECT EmployeeHistory.HISTORY_ID,         EmployeeHistory.POSITION,         EmployeeHistory.WAGE,         EmployeeHistory.EMPL_ID,         EmployeeHistory.START_DATE,         EmployeeHistory.END_DATE FROM EMPLOYEE_HISTORY EmployeeHistory WHERE (EmployeeHistory.HISTORY_ID = :fbkKy__0) AND (:SysEffectiveDateBindVar BETWEEN EmployeeHistory.START_DATE AND EmployeeHistory.END_DATE)
    [614] pStmt = conn.prepareStatement("SELECT EmployeeHistory.HISTORY_ID, EmployeeHistory.POSITION, EmployeeHistory.WAGE, EmployeeHistory.EMPL_ID, EmployeeHistory.START_DATE, EmployeeHistory.END_DATE FROM EMPLOYEE_HISTORY EmployeeHistory WHERE (EmployeeHistory.HISTORY_ID = :fbkKy__0) AND (:SysEffectiveDateBindVar BETWEEN EmployeeHistory.START_DATE AND EmployeeHistory.END_DATE)"); // JBO-JDBC-INTERACT
    [615] Bind params for ViewObject: [com.test.sdo.dateeffective.employee.history.EmployeeHistoryView]EmplHistoryAppModule.EmployeeHistoryView_1_findByKey_
    [616] Binding param "SysEffectiveDateBindVar": 2010-10-01
    [617] // ERROR: Unknown data type oracle.jbo.domain.Date // JBO-JDBC-INTERACT
    [618] pStmt.setObjectAtName(SysEffectiveDateBindVar, "2010-10-01");  // JBO-JDBC-INTERACT
    [619] Binding param "Bind_SysEffectiveDate": 2010-10-01 00:00:00.0
    [620] // ERROR: Unknown data type java.sql.Timestamp // JBO-JDBC-INTERACT
    [621] pStmt.setObjectAtName(Bind_SysEffectiveDate, "2010-10-01 00:00:00.0");  // JBO-JDBC-INTERACT
    [622] ViewObject: [com.test.sdo.dateeffective.employee.history.EmployeeHistoryView]EmplHistoryAppModule.EmployeeHistoryView_1_findByKey_ close single-use prepared statements
    [623] pStmt.close(); // JBO-JDBC-INTERACT
    [624] QueryCollection.executeQuery failed...
    [625] java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL: Bind_SysEffectiveDate
         at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
         at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectAtName(OraclePreparedStatement.java:11178)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObjectAtName(OraclePreparedStatementWrapper.java:815)
         at weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_OraclePreparedStatementWrapper.setObjectAtName(Unknown Source)
         at oracle.jbo.server.OracleSQLBuilderImpl.bindParamValue(OracleSQLBuilderImpl.java:4655)
         at oracle.jbo.server.BaseSQLBuilderImpl.bindParametersForStmt(BaseSQLBuilderImpl.java:3645)
         at oracle.jbo.server.ViewObjectImpl.bindParametersForCollection(ViewObjectImpl.java:19288)
    In Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1) at chapter 5.2 says that environmnet uses :Bind_SysEffectiveDate bind variable for passing effective date for Date Effective Business Components. But I see that in my case :SysEffectiveDateBindVar bind variabe is used for get method and both variables are used in update method.
    Why environment trying to bind :Bind_SysEffectiveDate if only :SysEffectiveDateBindVar is present in the query ? How can I solve this problem ?
    I'm using
    Oracle JDeveloper Studio Edition Version 11.1.1.3.0
    WebLogic Server Version: 10.3.3.0
    Oracle SOA Suite 11.1.1.
    Edited by: user2975420 on 01.10.2010 6:26

    As I understood ApplicationModule.EFF_DT_PROPERTY_STR is used to pass the value of SysEffectiveDate. This means that this value will bind to variable that present in query filter (:Bind_SysEffectiveDate).
    If this property is not set, the current date value binds to :Bind_SysEffectiveDate variable.
    But the reason of my problem is another.
    When I create date effective entity and date effective view object for this entity the query of VO is next (I see this query in query editor in JDeveloper):
    SELECT EmployeeHistory.HISTORY_ID,
    EmployeeHistory.POSITION,
    EmployeeHistory.WAGE,
    EmployeeHistory.EMPL_ID,
    EmployeeHistory.START_DATE,
    EmployeeHistory.END_DATE
    FROM EMPLOYEE_HISTORY EmployeeHistory
    WHERE (:Bind_SysEffectiveDate BETWEEN EmployeeHistory.START_DATE AND EmployeeHistory.END_DATE)
    But when I invoke getEmployeeHistoryView1 method of view object service interface, the query which I see in log is next:
    SELECT EmployeeHistory.HISTORY_ID,
    EmployeeHistory.POSITION,
    EmployeeHistory.WAGE,
    EmployeeHistory.EMPL_ID,
    EmployeeHistory.START_DATE,
    EmployeeHistory.END_DATE
    FROM EMPLOYEE_HISTORY EmployeeHistory
    WHERE (EmployeeHistory.HISTORY_ID = :fbkKy__0)
    AND (:SysEffectiveDateBindVar BETWEEN EmployeeHistory.START_DATE AND EmployeeHistory.END_DATE)
    Bind variable for SysEffectiveDate has *:SysEffectiveDateBindVar* name now instead of *:Bind_SysEffectiveDate*. But method invokes successfully.
    When I invoke updateEmployeeHistoryView1 environmet already tryes to bind *:Bind_SysEffectiveDate* variable that doesn't present in query. So I have exception:
    java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL: Bind_SysEffectiveDate
    I'm not understanding why environment binds :Bind_SysEffectiveDate parameter which doesn't present in query.

  • Using bind variables in Oracle SQL developer

    Hi all,
    i am using Oracle SQL developer. i want to use the bind variable in my sql.
    variable myid number :=1;
    select * from mds_3618_request where id = :myid;
    but i am getting the below error.
    Error starting at line 2 in command:
    select * from mds_3618_request where id = :myid
    Error report:
    SQL Error: Missing IN or OUT parameter at index:: 1
    Does Oracle SQL developer support bind variables in the SQL statements?
    thanks in Advance
    Vali Shaik

    You are probable going to get a quicker answer on this forum : SQL Developer
    -- Andy

  • EA3/EA2/EA1 - Bind Variables in PL/SQL

    EA1 seems to have taken a backward step when it comes to supporting bind variables in PL/SQL.
    Back in 1.1.3, according to the bugs fixed list, we apparently fixed bug 5884935 (BINDS IN A PL/SQL STATEMENT HAS "NOT ALL VARIABLES BOUND" ERROR), although this was only ever when running as scripts (as per Bind variables in PLSQL bug not fixed?
    Now according to the 1.2 documentation, bind variables are not supported in the script runner (section 1.7.2) and the SQL*Plus variable command is not supported (section 1.7.1). However, I can run the following code "successfully" (no errors reported but the substitution text entered does not appear in the dbms_output):
    variable bind_text varchar2(30);
    declare
    l_text varchar2(30);
    begin
    :bind_text := '&sub_text';
    dbms_output.put_line('Bind text: "' || :bind_text || '"');
    end;
    Now in EA1, running this as a script results in "ORA-01006: bind variable does not exist"
    Running the variable statement results in "ORA-00900: Invalid SQL Statement" and running the PL/SQL results in "ORA-1008: not all variables bound".
    Can someone from the SQL Developer team please comment on the intended support for bind variables in PL/SQL?
    Thanks,
    theFurryOne

    I know that the variable command isn't supported (as I said above), but that was also the case in 1.2, where it did actually sort of work.
    I am not talking about local PL/SQL variables declared within the PL/SQL - I am trying to get user entered values into the PL/SQL in the same way as prompting for bind variable values in SQL.
    So using SQL Developer bind variables inside PL/SQL is my end goal - preferably when running anonymous PL/SQL blocks as statements in the worksheet.
    However, as there have been "fixed" bugs to enable bind variables in PL/SQL, which require the use of SQL Plus commands that are not supported in SQL Developer (ie variable), I am trying to work out what the development team think the intended support for bind variables in PL/SQL is. Then I will know if what I want needs to be reported as a bug or logged as an enhancement request.
    theFurryOne

  • How to enter bind variables in Calender SQL statement

    Hi,
    Anyone know how to include bind variables in Calender SQL statement. Let's say in sql statement below:
    select
    EMP.HIREDATE the_date,
    EMP.ENAME the_name,
    null the_name_link,
    null the_date_link,
    null the_target
    from SCOTT.EMP
    order by EMP.HIREDATE
    thanks.

    Hi,
    Here is the sql statement
    select
    EMP.HIREDATE the_date,
    EMP.ENAME the_name,
    null the_name_link,
    null the_date_link,
    null the_target
    from SCOTT.EMP
    where deptno = :dept
    order by EMP.HIREDATE
    Thanks,
    Sharmila

  • How to use an UNIX shell variable in sql where clause

    Hi ,
    In my shell script first I get the Date and time from the system into the shell variable.At the end of the shell script I need to run a sql script in which I want to use the variable value in the where clause . Is there any way we can use a shell variable value in SQl script ?. Any help is greatly appriciated .
    Thanks in advance,
    Sampath

    Try the following
    In Unix
    SQLPLUS <username>/<password> @MyScript.sql <UNIX_Variable>
    In SQL*Plus
    Reference the variable as &1
    select *
    from MyTable
    where MyDate = to_date('&1','<date_format>');

  • Bind variable in PL/SQL

    What is the use of bind variables in PL/SQL..?? Give some examples.
    Thanks in advance!!

    In static SQL, bind variables are automatically used in PL/SQL.
    For a dynamic SQL example, see http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/11_dynam.htm#13131

  • How to use sql "IN" operator with named bind variable in where clause ?

    Can one bind variable be used for the "IN" list ('1','2','3') ?

    rob,
    No worries. Glad it helped. Glad to see also that you're doing things right and trying to use bind variables ;)
    May I suggest adding "SOLVED" to the title of the original post?
    Best,
    John

  • Bind variables and Dynamic sql

    I have this function which works only when i'm not passing bind variables. The moment i add bind variables it is not able to execute the function.
    Oracle Db Version: 8.1
    Thanks
    Source Code
    FUNCTION TestFunction( In_Test_id in Number,
    In_Asof in Date )
    Return ScoreType
    IS
    LvScore ABC.LV_SCORE.SCORE%TYPE;
    DVScore ABC.LV_SCORE.SCORE%TYPE;
    Begin
    EXECUTE IMMEDIATE
    'SELECT SCORE,DVSCORE
    FROM
    SELECT SCORE,DVSCORE
    DENSE_RANK() OVER (PARTITION BY TEST_ID ORDER BY ASOF_DT DESC) AS score_RANK
    FROM ABC.LV_SCORE
    WHERE TEST_ID = :x
    AND ASOF_DT <= :y
    ) WHERE score_RANK = 1'
    INTO LvScore,DVScore
    USING In_tEST_ID,In_Asof;
    Return ScoreType( LvScore,
    DVScore);
    End;

    It just keeps on executing for sometime and then disconnects itself from database What was the indication that told you that it disconnected? Was there a visible indication of this disconnect?
    Did you get ORA-03113?
    ===========================================
    ORA-03113: end-of-file on communication channel
    Cause: The connection between Client and Server process was broken.
    Action: There was a communication error that requires further investigation. First, check for network problems and review the SQL*Net setup. Also, look in the alert.log file for any errors. Finally, test to see whether the server process is dead and whether a trace file was generated at failure time.

  • VO with bind variable defined in SQL is not updated correctly

    Hi Experts,
    I have one simple question here, could you please help answer? Thanks a lot!
    I have 2 pages, the first page displays an employee table, the second page shows some details related to the selected employee. When select one employee and click on the detail button I can be naviaged to the second page and see the details for the selected employee. The vo used on the second page uses a bind variable called "empId" which is binding to a pageFlowScope value 'adf.context.pageFlowScope.empId', and this pageFlowScope value will be populated to the selected empId in detail button actionListener at runtime).
    The question here is, now the first navigating is ok, the detail page can show the correct information for the employee selected on the employee page, but when navigating back and choosing another employee, and then click on the detail button again, the detail page is NOT updated, it still shows the first selected employee information. I do debug the actionListener in the backing bean and the second selected empId does get passed to pageFlowScope.empId, the bind variable in the VO should get the new value, right? but why the second page does not get updated (query using the new bind variable value)?
    Thanks!
    Edited by: user774592 on Jul 20, 2011 11:13 PM
    Edited by: user774592 on Jul 20, 2011 11:15 PM
    Edited by: user774592 on Jul 20, 2011 11:15 PM

    Hi Timo,
    Thanks for you response! The JDev version I used is 11.1.2.0.0. Actually, they are different VOs, the 1st page is EmployeeVO, the second page is ResourceSummaryVO which binds the empId variable in SQL. The ActionListener code is as below.
    public void viewResSummary(ActionEvent actionEvent) {
    // Add event code here...
    DCBindingContainer bc = (DCBindingContainer)this.getBindings();
    DCIteratorBinding empIteBinding =
    bc.findIteratorBinding("SEmployeeView1Iterator");
    //Get employee id from the current selected employee record
    Row currentRow = empIteBinding.getRowSetIterator().getCurrentRow();
    Long employeeId = ((DBSequence)currentRow.getAttribute("EmployeeId")).getValue();
    //Set employeeId as a pageFlowScope object which will be used in ResourceSummaryPage
    AdfFacesContext.getCurrentInstance().getPageFlowScope().put("empId", employeeId);
    empId is defined using Bind Variable Dialog and is referenced in ResourceSummaryVO on the second page. I used the EL expression to defined its value to adf.context.pageFlowScope.empId which will be populated using above code at runtime.
    Again, thanks for your help!

  • How to pass a bind variable from one SQL Report to Another

    Hello~
    I've created a link on one SQL Report page (Page 1). I would like a value from Page 1 used in the SQL on Page 2 to determine the result set. The Where Clause in SQL Query containing the bind variable is as follows:
    AND hp.party_name     = ':District_Account'
    When I run Page 1 and click on the link to execute Page 2, I get 'No Data Found'. The setup of the link is as follows:
    Column_Name = District_Account
    Link Text = #District_Account#
    Target = Page in this application
    Page = 2
    I'm a rookie working in V1.6...any help would be greatly appreciated!
    Thanks,
    Becky

    I don't see any parameter being passed in that URL. A little sample: http://htmldb.oracle.com/pls/otn/f?p=33203:4<br>
    when you click on the edit link the URL looks like this:<br>http://htmldb.oracle.com/pls/otn/f?p=33203:5:16073998852455071705::NO:5:P5_TABLE_NAME,P5_OWNER:PRESIDENTS_THEMES%2CBLUETEST<br><br>
    where P5_TABLE_NAME and P5_OWNER are the items and PRESIDENTS_THEMES and CBLUETEST are the values.<br><br>
    The SQL on the filtered report looks like:<br>
    SELECT *
    FROM all_tab_cols
    WHERE table_name = :P5_TABLE_NAME
      AND owner = :P5_OWNER<BR><BR>

  • How do I use bind variables for the SQL statements having IN clause

    SELECT id, name FROM t
    WHERE id in (10,20,30)
    As the IN list will have 'n' number of values, I am not able to specify fixed number of bind
    variables like
    SELECT id, name FROM t
    WHERE id in (?,?,?....)

    452051 wrote:
    I am not able to specify fixed number of bind variablesYou could use collection:
    SQL> create or replace force
      2    type NumList
      3      as
      4        table of number
      5  /
    SQL> select ename from emp where deptno member of NumList(10)
      2  /
    ENAME
    CLARK
    KING
    MILLER
    SQL> select ename from emp where deptno member of NumList(10,20,30)
      2  /
    ENAME
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    ENAME
    JAMES
    FORD
    MILLER
    14 rows selected.
    SQL> This way you have one bind variable - collection.
    SY.

  • Bind variables in custom sql subquery

    Is it possible to use bind variables in a custom sql subquery? I have a top level query built with expressions and I am using the builder.subQuery() method to execute the report query containing the custom sql.
    Thanks,
    Will

    Yes, that should be possible. Here is what to do. Make your SQL string. Where you want to bind variables, use a question mark.
    example: select empId from employee where employeeId=?
    Then you want to create a Call object. Then you can do ReportQuery rq = new ReadAllQuery (sqlCall);
    here is how to bind:
    queryParams is a Collection
    //start code
    Call sqlCall = new SQLCall();
    ((SQLCall)sqlCall).setSQLString(sqlString);
    if ((queryParams != null) && (queryParams.size() > 0)) {
         Vector sqlParameterTypes = new Vector(queryParams.size());
         Vector sqlParameters = new Vector(queryParams.size());
         Iterator iter = queryParams.iterator();
         while (iter.hasNext()) {
              Object queryParameter = iter.next();
              sqlParameterTypes.add(SQLCall.IN);
              sqlParameters.add(queryParameter);
         ((SQLCall)sqlCall).setParameterTypes(sqlParameterTypes);
         ((SQLCall)sqlCall).setParameters(sqlParameters);
    //end code
    I hope this helps. The APIe changed from 9.0.4.5 to 10.1.3 so this code is for 10.1.3. Post if you have any more questions.
    Zev.

  • Unknow number of binding variables in Dynamic SQL

    I have to use a dynamic sql and binding variables. The problem is the number of binding variable varies due to the form input.
    EX.
    if ( something is not null ) then
    query := query || ' and column = :column';
    end if;
    if ( something_else is not null ) then
    query := query || ' and another_column = :another_column';
    end if;
    When I use in my USING clause, I don't know which of the four combinations of column/another_column I could be
    open query;
    open query using A,B;
    open query using A;
    open query using B;
    How can I solve this problem?
    Thanks a lot!

    Always with NVL:
    query := query || ' AND column = NVL(:column,column ) AND another_column = NVL(:another_column,another_column)';Invoke:
    DECLARE
      a_null CHAR(1); -- set to NULL automatically at run time
    BEGIN
      --open query
      open query using (a_null,a_null)
      --open query using A,B
      open query using A,B;
      --open query using A
      open query using A,a_null;
      --open query using B
      open query using a_null ,B;
    END;
    /Edited by: jortri on 04-dic-2008 18:34

Maybe you are looking for