PreparedStatement and bind variable

We are experiencing some werid performance break downs where database server looks healthy and our java applications are down to their knees.
I was wondering if someone could help me clarify the comparison between PreparedStatement and bind variable. When I execute a PreparedStatement in java through the JDBC thin driver, would the database consider it a dynamic SQL or is it a SQL using bind variable? If this same statement is executed 100000 times, is it parsed 100000 times? We are using JDK131. How does it work?
Is there any memory leak in PreparedStatement implementation in JDBC thin driver? Is there any known symptom to this problem? What is the recommended solution?
Thank you very much!

If PreparedStatement is parsed and cached, why is there setting to set implicit statement caching and explicit statement caching? Our DBA insists that it is parsed every single time. How would I find out for sure?
The SQLs have not been changed. This sudden performance degradation started when a new client went live and we experienced higher than usual volumn. We are connecting using JDBC thin client from weblogic server to Oracle 8.1.7. It's been happening everyday since the client went live and the only way to get the performance back is to shutdown and restart the database server.
I tried to search JDBC related issues. The only complain that I've found so far is that there may be some potential memory leak for a PreparedStatement. However, I have not found anything from Oracle's website that concurs to that.
What is my best bet?

Similar Messages

  • Lexical and bind variables in RUN_PRODUCT

    Hi all,
    I have the following RUN_PRODUCT but it gives me "bad bind variable:
    DECLARE
    pl_id ParamList;
    BEGIN
    pl_id := Create_Parameter_List('tmpdata');
    Add_Parameter(pl_id,'CATEGORY',TEXT_PARAMETER,(:CATEGORY));
    Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
    Add_Parameter(pl_id, 'DESTYPE', TEXT_PARAMETER, 'Screen');
    Run_Product(REPORTS, 'C:\Pled', SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL);
    Destroy_Parameter_List( pl_id );
    END;
    How can I define both lexical and bind variables in a RUN_PRODUCT. Please assist!

    Hello Nicky,
    The correct way to call Reports from Forms in 6i using the RUN_PRODUCT built-in using bind parameters would be something like the code given below. This example assumes that you have a form module parameter and a report parameter called 'category'.
    declare
    pl_id paramlist;
    begin
    pl_id := create_parameter_list('tmpdata');
    add_parameter(pl_id, 'category', text_parameter, :parameter.category);
    add_parameter(pl_id, 'paramform', text_parameter, 'no');
    add_parameter(pl_id, 'destype', text_parameter, 'screen');
    run_product(reports, 'c:\test_report.rdf', synchronous, runtime, filesystem, pl_id, null);
    destroy_parameter_list( pl_id );
    end;
    Thanks,
    The Oracle Reports Team.

  • Help setting Parameters using JDBC and Bind Variables for Oracle List

    I fully understand the concept of using Bind Variables when using JDBC to avoid hard parses everytime my SQL statement is executed when only a certain value changes. For example, perhaps I have the following statement:
    PreparedStatement ps = con.prepareStatement("select salary from employees where employee_id = ?");
    I would then set the value of the question mark (the first and in this case only parameter) using:
    ps.getStmt().setString(1,empId1);
    That is assuming I have the variable empId1 populated with what I want. Anyway, my question has to do with Oracle lists. In other words, if I am just executing the statement against the db, it might look like:
    select salary from employees where employee_id in ('123','456','789');
    I still want to use bind variables and I can do it in JDBC with something like:
    select salary from employees where employee_id in ('123','456','789');
    ps.getStmt().setString(1,empId1);
    ps.getStmt().setString(2,empId2);
    ps.getStmt().setString(3,empId3);
    BUT, what if I just want to construct my list of ids upfront as a string and do something like:
    select salary from employees where employee_id in (?)
    ps.getStmt().setString(1,listOfEmpIds);where listOfEmpIds would look something like '123','456','789'.
    That's what I want to do but it doesn't work. It would be treating the list as a single parameter as opposed to lots of individual parameters. Can someone please tell me the syntax for this if it is possible? I have tried where XX in (?) and where XX in ? (and the string I substitute has the parenthesis in it), but neither work.
    Thank you for your help.

    I always build the list myself.
    You could, however, pass the list as a varchar to a stored proc and then have the stored proc parse (or dynamically execute) using it.
    The second method might even be faster although I would suspect that is only going to be the case if the list is very large. Or it might not.

  • Dynamic sql and bind variables

    Hi,
    I have a stored procedure which filters a table on 5 five columns. The filters come from the input parameters,
    and these 5 parameters can come in any combination, I mean some of them may be null and some of them may not be null.
    So I constructed the where filter of the query with IF blocks like the following:
    dynamic_query := 'select * from TESTTABLE where 1= 1';
    IF (P1 is not null) THEN
    dynamic_query := dynamic_query || ' AND column1 = :1';
    END IF;
    IF (P2 is not null) THEN
    dynamic_query := dynamic_query || ' AND column2 = :2';
    END IF;
    IF (P3 is not null) THEN
    dynamic_query := dynamic_query || ' AND column3 = :3';
    END IF;
    IF (P4 is not null) THEN
    dynamic_query := dynamic_query || ' AND column4 = :4';
    END IF;
    IF (P5 is not null) THEN
    dynamic_query := dynamic_query || ' AND column5 = :5';
    END IF;
    OPEN CUR_OUT FOR dynamic_query USING P1, P2, P3, P4, P5;
    The problem is how can I construct the USING and bind parameters, I cannot use "USING P1, P2, P3, P4, P5" because some of bind variables
    may not be in dynamic query if the input parameters are null. Is there a way to overcome this problem without writing all the 2 ^ 5 combinations?
    Any help is greatly appreciated.

    here it is in the Tomer Cohen way:
    IF (P1 is not null) THEN
    dynamic_query := dynamic_query || ' AND column1 = :1';
    ELSE
    dynamic_query := dynamic_query || ' AND  :1 IS NULL';
    END IF;
    IF (P2 is not null) THEN
    dynamic_query := dynamic_query || ' AND column2 = :2';
    ELSE
    dynamic_query := dynamic_query || ' AND  :2 IS NULL';
    END IF;
    IF (P3 is not null) THEN
    dynamic_query := dynamic_query || ' AND column3 = :3';
    ELSE
    dynamic_query := dynamic_query || ' AND  :3 IS NULL';
    END IF;
    IF (P4 is not null) THEN
    dynamic_query := dynamic_query || ' AND column4 = :4';
    ELSE
    dynamic_query := dynamic_query || ' AND  :4 IS NULL';
    END IF;
    IF (P5 is not null) THEN
    dynamic_query := dynamic_query || ' AND column5 = :5';
    ELSE
    dynamic_query := dynamic_query || ' AND -1 = :5';
    END IF;
    OPEN CUR_OUT FOR dynamic_query USING P1, P2, P3, P4, P5;Amiel Davis

  • Report queries and bind variables - only header printing to PDF

    Hi,
    I created a simple report query for printing to PDF with 2 bind variables. I created a link to this report like this
    Print - the header information prints but none of the data.
    What am i doing wrong? I'm pretty sure it has s/t to do with the bind variables.
    IF a/o can please help, i'd really appreciate it.
    Thanks,
    Hindy

    is it possible to export your application page to apex server and you shall also create a userid as demo/demo and post the url so that we shall try the debug

  • Child reports and bind variables

    I'm working on a user defined parent/child report. What I'm having an issue with is using a parents bind variable value in a child. To simpify my example:
    The master query is:
    select count(*), document
    from download_audit
    where activity_date > sysdate-:DAYS
    group by document
    which returns a count of downloads for each document in the last :DAYS days. I want the child report to then list the person that downloaded a selected document:
    select document, user_id, activity_date from download_audit
    where activity_date > sysdate - :DAYS
    and document=:DOCUMENT
    This does not work because the initial :DAYS bind isn't sent to the child.
    If I add the :DAYS as a selected column to the master sql it works. e.g.
    select count(*), document, :DAYS days
    from download_audit
    where activity_date > sysdate-:DAYS
    group by document
    My question is, do child bind variables all have to be selected columns in the master query or is there a way to have a "global" bind variable that gets carried from master to child?
    I'm using SQL Developer 3.2.20.09 on OS X Lion
    Edited by: RoboMan on Nov 16, 2012 11:23 AM

    I agree whole heartedly :)
    If you want to make things even more interesting, create some 3rd generation child reports and carry the bind variables throughout the multiple levels - here's an example
    http://www.thatjeffsmith.com/archive/2012/09/grandparent-parent-child-reports-in-sql-developer/

  • Why CBO don't use function-base index when I use like and bind variable

    Hello
    I have litle problem with function-base index and like with bind variable.
    When I use like with bind variable, the CBO don't use my function-base index.
    For example when I create table and index:
    ALTER SESSION SET NLS_SORT='BINARY_CI';
    ALTER SESSION SET NLS_COMP='LINGUISTIC';
    alter session set nls_language='ENGLISH';
    -- DROP TABLE TEST1;
    CREATE TABLE TEST1 (K1 VARCHAR2(32));
    create index test1_idx on test1(nlssort(K1,'nls_sort=BINARY_CI'));
    INSERT INTO TEST1
    SELECT OBJECT_NAME FROM ALL_OBJECTS;
    COMMIT;
    When I run:
    ALTER SESSION SET NLS_SORT='BINARY_CI';
    ALTER SESSION SET NLS_COMP='LINGUISTIC';
    SELECT * FROM TEST1 WHERE K1 = 'abcd';
    or
    SELECT * FROM TEST1 WHERE K1 LIKE 'abcd%';
    CBO use index.
    PLAN_TABLE_OUTPUT
    SQL_ID 4vrmp7cshbvqy, child number 1
    SELECT * FROM TEST1 WHERE K1 LIKE 'abcd%'
    Plan hash value: 1885706448
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 1 (100)| |
    | 1 | TABLE ACCESS BY INDEX ROWID| TEST1 | 2 | 98 | 1 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | TEST1_IDX | 2 | | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - access("TEST1"."SYS_NC00002$">=HEXTORAW('6162636400') AND
    "TEST1"."SYS_NC00002$"<HEXTORAW('6162636500') )
    but when I run
    SELECT * FROM TEST1 WHERE K1 LIKE :1;
    CBO don't use index
    PLAN_TABLE_OUTPUT
    SQL_ID 9t461s1669gru, child number 0
    SELECT * FROM TEST1 WHERE K1 LIKE :1
    Plan hash value: 4122059633
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 89 (100)| |
    |* 1 | TABLE ACCESS FULL| TEST1 | 2 | 48 | 89 (3)| 00:00:02 |
    Predicate Information (identified by operation id):
    1 - filter("K1" LIKE :1)
    What should I change to force CBO to use index.
    I don't wont use index hint in query.
    My oracle version:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

    OK. But why if I create normal index (create index test1_idx on test1(K1)) and return to default nls settings this same query use index.
    PLAN_TABLE_OUTPUT
    SQL_ID 9t461s1669gru, child number 0
    SELECT * FROM TEST1 WHERE K1 LIKE :1
    Plan hash value: 598212486
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 1 (100)| |
    |* 1 | INDEX RANGE SCAN| TEST1_IDX | 1 | 18 | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - access("K1" LIKE :1)
    filter("K1" LIKE :1)
    Note
    - dynamic sampling used for this statement (level=2)
    when index is function-base (create index test1_idx on test1(nlssort(K1,'nls_sort=BINARY_CI')))
    PLAN_TABLE_OUTPUT
    SQL_ID 9t461s1669gru, child number 1
    SELECT * FROM TEST1 WHERE K1 LIKE :1
    Plan hash value: 4122059633
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 89 (100)| |
    |* 1 | TABLE ACCESS FULL| TEST1 | 3 | 54 | 89 (3)| 00:00:02 |
    Predicate Information (identified by operation id):
    1 - filter("K1" LIKE :1)
    Note
    - dynamic sampling used for this statement (level=2)
    when I create index with upper function "index test1_idx on test1(upper(K1))" the query use index
    SELECT * FROM TEST1 WHERE upper(K1) LIKE :1
    Plan hash value: 1885706448
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 1 (100)| |
    | 1 | TABLE ACCESS BY INDEX ROWID| TEST1 | 4481 | 157K| 1 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | TEST1_IDX | 806 | | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - access("TEST1"."SYS_NC00002$" LIKE :1)
    filter("TEST1"."SYS_NC00002$" LIKE :1)
    Note
    - dynamic sampling used for this statement (level=2)

  • ManagedBean and Bind Variables in ADF applications

    Situation with Target Unreachable, 'TestBean'.
    ManagedBean: TestBean, parameter objectId
    ViewObject: sql-based: select * from someobject where id = :objectId
    Unbounded taskflow with the one page: Start.jspx
    Bounded TaskFlow "TestTaskFlow" with pagefragments: ButtonView.jsff and ObjectCard.jspx (as dialog).
    On the ButtonView there is a button with: action="dialog:OBJECT", actionListener.
    ActionListener handler I create by using the JDev Wizard. And the record was appeared in the adfc-config.xml. Is it correct? since the button is in the Taskflow. So in the taskflow there is no records about managed beans. May be it is Ok.
    Than, on the ObjectCard.jspx add ExecuteWithParams VO method, and set bind variable from the managedbean attribute. and get an error:
    SEVERE: Server Exception during PPR, #1
    javax.servlet.ServletException: Target Unreachable, 'TestBean' returned null
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:270)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:181)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:279)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:239)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:196)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:102)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:65)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: javax.faces.el.EvaluationException: Target Unreachable, 'TestBean' returned null
         at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:58)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1227)
         at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
         at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:142)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:754)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:282)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:175)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         ... 27 more
    Than I add this managedbean in the Taskflow too. There is no exception, but bind variables has not been set.

    Hi,
    most likely the managed bean got created in the adfc-config.xml file. If then it has a scope of pageFlowsScope, then it cannot be found. Move the managed bean or use it with a scope of requestScope or backingBeanScope
    Frank

  • V$Sqlarea, Audit, and Bind Variables

    I have enabled auditing to track down a problem. With the info in SYS.AUD$ tied to V$SESSION and V$SQLAREA I can see the actual statement that the user executed. The problem that I have is that everything is in bind variables.
    Does anybody know how to find the values within the bind variables for a session in $SQL_AREA?
    Thanks in advance,
    Chris S.

    Which version of the database are you using? Have you considered using Oracle9i's Fine Grained Audit functionality.
    Cheers, APC

  • Query and bind variable display in reports

    I have created a reports portlet using the locally built providers facility with the create a new reports. It seems to work fine except that the sql query and the bind variables show up in the report along with the report itself. How do I keep these from showing up?? I am on Portal 9.04
    Ken Rubesh

    ON the Page displayoptions tab, you can select "Show Query Conditions?..
    is that unselected?
    if you are talking about the fields from your select statement showing up in the body of the report, you can set the field type to hidden on the 2nd tab(column formatting).
    hope this helps

  • TO_DATE and bind variables in SQLJ

    Hi all
    I need to convert a date, in string format using TO_DATE in an INSERT INTO contained in a sqlj class. The reason for this is I am reading in data from a pipe delimited file created by a MUMPS application. (Don't ask:)).
    This works fine if I use the date in the function during testing i.e
    :SOMEVAL,
    TO_DATE('21-04-2003',DD-MON-YYYY'),
    :SOMEOTHERVAL,
    I though want to use a bind variable containing the date read in from the file.
    :SOMEVAL,
    TO_DATE(':DOB','DD-MON-YYYY'),
    :SOMEOTHERVAL,
    When I do the second example, I get a missing comma error at run time. Am I asking SQLJ to do somthing it can't or do I have the syntax wrong... I hope its the latter. I can find examples of both of the above but not combined in one statement.
    Neil

    I believe you merely need to get rid of the quotes around :DOB in your second statement.
    Justin

  • Open cursor for and bind variables

    Hello all,
    how can I assign values to a bind variable before opening a cursor?
    example code:
    DECLARE
       TYPE ref_cur_t IS REF CURSOR;
       l_ref_cur   ref_cur_t;
       l_query VARCHAR2 (100)
             := 'select * from table t1 where ndx= :var_index' ;
    BEGIN
       -- assign a value to :var_index
       OPEN l_ref_cur FOR l_query;
    END;Thanks!

    Something like this ->
    scott@ORCL>
    scott@ORCL>DECLARE
      2     l_ref_cur   sys_refcursor;
      3     l_query VARCHAR2 (100) := 'select * from emp where empno = :var_index';
      4     l_empno  number(4);
      5  BEGIN
      6     l_empno := &emno;
      7     -- assign a value to :var_index
      8     OPEN l_ref_cur FOR l_query using l_empno;
      9  END;
    10  /
    Enter value for emno: 7698
    old   6:    l_empno := &emno;
    new   6:    l_empno := 7698;
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:19.78
    scott@ORCL>Regards.
    Satyaki De.

  • Procedure and Bind Variable

    I'm trying to write a procedure for an exercise I'm working on. I got an error that I needed to use a "Bind Variable," so now I'm trying to pass a bind variable to the procedure. I am supposed to get user input.
    CREATE OR REPLACE PROCEDURE insert_glaccount
    account_num_pram general_ledger_accounts.account_number%TYPE,
    account_desc_pram general_ledger_accounts.account_description%TYPE
    AS
    BEGIN
    INSERT INTO general_ledger_accounts
    VALUES (account_num_pram, account_desc_pram);
    /*Error handling to coming soon*/
    END;
    VARIABLE account_num_var general_ledger_accounts.account_number%TYPE;
    VARIABLE account_desc_var general_ledger_accounts.account_description%TYPE;
    BEGIN
    :account_num_var := &account_num;
    :account_desc_var := &account_desc;
    CALL insert_glaccount(:account_num_var, :account_desc_var);
    END;
    Now I'm getting an error: "Bind Variable "account_num_var" is NOT DECLARED"
    Can someone please explain how I'm messing this up?

    I don't know if that helps. Now I have this, but it still doesn't work. It looks like the procedure it's self is working, but not the script where I call the procedure:
    CREATE OR REPLACE PROCEDURE insert_glaccount
    account_num_pram general_ledger_accounts.account_number%TYPE,
    account_desc_pram general_ledger_accounts.account_description%TYPE
    AS
    BEGIN
    INSERT INTO general_ledger_accounts
    VALUES (account_num_pram, account_desc_pram);
    COMMIT;
    EXCEPTION
    WHEN DUP_VAL_ON_INDEX THEN
    DBMS_OUTPUT.PUT_LINE('A dup val on index error occurred.');
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('An unknown exception has occurred.');
    END;
    DECLARE
    account_num_var general_ledger_accounts.account_number%TYPE;
    account_desc_var general_ledger_accounts.account_description%TYPE;
    BEGIN
    account_num_var := &account_num; -- Get user input for account number
    account_desc_var := &account_desc; -- Get user input for account description
    CALL insert_glaccount(account_num_var, account_desc_var);
    END;
    /

  • Order of placeholders and bind variables (ORA-01008)

    Hi, Everyone,
    OS: Redhat Linux AS 3
    Compiler : g++ 3.2.3
    OCCI : 10.2
    When a SELECT statement has more than 2 same placeholders,
    I have experienced that stmt->executeQuery() throws SQLException (ORA-01008).
    <case1>
    std::string sql1 =
    "SELECT str FROM tbl_sample WHERE col01 = :1 and col02 = :1 and col03 = :2";
    stmt1->setInt(1, num1);
    stmt1->setInt(2, num2);
    ResultSet* rs = stmt1->executeQuery(); // NG. thrown ORA-01008
    <case2>
    std::string sql1 =
    "SELECT str FROM tbl_sample WHERE col01 = :1 and col02 = :1 and col03 = :2";
    stmt1->setInt(1, num1);
    stmt1->setInt(2, num1);
    stmt1->setInt(3, num2);
    ResultSet* rs = stmt1->executeQuery(); // OK.
    <case3>
    std::string sql1 =
    "SELECT str FROM tbl_sample WHERE col01 = :1 and col03 = :2 and col02 = :1";
    stmt1->setInt(1, num1);
    stmt1->setInt(2, num2);
    ResultSet* rs = stmt1->executeQuery(); // OK.
    In <case1>, I understand that the one line "stmt1->setInt(1, num1);" cannot bind two placeholders
    (:1 of "WHERE col01 = :1 and col02 = :1 ") with the value of num1 simultaniously.
    So, I have found that the code should be written in like <case2>.
    But, in <case3>, the one line "stmt1->setInt(1, num1);" can bind two placeholders
    (:1 of "col01 = :1 and col02 = :1") simultaniously!
    The difference of <case1> and <case3> is the order of the placeholders (:1 and :2).
    How should I understand this behavior?
    I'm afraid that this is the bug of OCCI.
    How do you think of it?
    Thanks in advance.
    Yoshitaka Egawa

    Its not the complete query. I can't reproduce in 11106. Why you have subsiution variables shown here?
    SQL> select * from V$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    SQL> select empno from emp where empno in ( select anyno from dept);
    select empno from emp where empno in ( select anyno from dept)
    ERROR at line 1:
    ORA-00904: "ANYNO": invalid identifier
    SQL> desc emp
    Name                                      Null?    Type
    EMPNO                                     NOT NULL NUMBER(4)
    ENAME                                              VARCHAR2(10)
    JOB                                                VARCHAR2(9)
    MGR                                                NUMBER(4)
    HIREDATE                                           DATE
    SAL                                                NUMBER(7,2)
    COMM                                               NUMBER(7,2)
    DEPTNO                                             NUMBER(2)
    SQL> desc dept
    Name                                      Null?    Type
    DEPTNO                                    NOT NULL NUMBER(2)
    DNAME                                              VARCHAR2(14)
    LOC                                                VARCHAR2(13)
    SQL>HTH
    Aman....

  • Email and bind variable

    I have to send the following data via email. The email is sent without any problem but I need to replace the variable with value entered on page. How do I do this?
    "Please note the employee :P24_EMP_EMAIL has applied for leave in the system." - This is being sent as it is...but I need to replace the &P24_EMP_EMAIL with the value that was entered on that page. How do I do this??

    I fixed it myself :)

Maybe you are looking for

  • Trigger a function after 1 minute while the app is open.

    Hey guys, I wrote a simple widget that reads from a rss file. My question is what's a good way to repeat a function every minute? The widget could run up to 8 hours straight.. Any ideas? I'd like to trigger bugsFeed.send(); once a minute. thanks!

  • Installed iTunes 9 as advised and now I can't access store

    Hi, just installed iTunes 9 and advised when trying to purchase a film and now I can't access the store. I can access my account etc but just get a blank screen when trying to access store! Have tried technical support but they say it's my computer's

  • SLD Business System with or with out Logical System If so, which Log system

    Hi I'm in confuse with the Logical System when creating a Business System in SLD. Our requirement is LEGACY -- PI/XI -- ECC. When I create Business sytem in SLD, I need to give a Logical System. Which system (Is it xi/pi or ECC ) Logical System to be

  • Why does CC still fail to update Apps even after the latest version (1.1.1.220)

    I haven't been able to update several software for weeks and thought the latest Createive Cloud  update on 8/20/13  (1.1.1.220) would solve the problem, it did not. I keep getting errors "Update Failed" Error encountered during installation. (U44M1P7

  • Cannot change synchronize setting for contacts!

    Hello! I have 2 emails set up on my BB curve 8520. When i added contacts i somehow added some to sync on one email and some on the other. Now when i sync to microsoft oulook it only adds contacts from one e-mail. I tried to edit the sync option on my