How to identify the bind variable peeking problem?

How to identify the bind variable peeking problem whether my db hitting or not and how to resolve it?
currently we are doing the dbms_stat of application schema's with gather auto option and i hope this option we take the histogram stats also. Is there any option to improve it and its highly transactions oltp env of 11g.

What is your exact 4 digits Oracle version ?
Bind peeking issues are supposed to be solved with adaptative cursor sharing in 11.1 and 11.2:
11.1 http://download.oracle.com/docs/cd/B28359_01/server.111/b28274/optimops.htm#sthref919.
11.2 http://download.oracle.com/docs/cd/E11882_01/server.112/e16638/optimops.htm#PFGRF94588
which says also:
>
Adaptive cursor sharing is enabled for the database by default and cannot be disabled. Note that adaptive cursor sharing does not apply to SQL statements containing more than 14 bind variables.
>
Edited by: P. Forstmann on 10 nov. 2011 13:50

Similar Messages

  • How to use the bind variable in custom.pll

    Hi,
    How to use the bind variable in custom.pll.Its through error.
    any one gem me.
    very urgent.
    M.Soundrapandian.

    Hello,
    Please, ask this kind of questions in the e-business forum.
    Francois

  • How to pass the bind variable value to the sql statement of the LOV

    Hi,
    I am using Forms 10g builder.
    I have a text item which will be populated by a LOV when i press a button, but i have a bind variable in the SQL statement of the LOV. That bind variable should be replaced by a value which is derived from a radio group in the same data block.
    For Ex: ( )radio1 ( )radio2
    before i click on the push button, I'll select one of the radio button above,so my question is how to assign this radio group value to the bind variable in the sql statement in the LOV?
    Pl any hint is appreciated!
    Thanks
    Reddy

    The variable can be taken into account in the SELECT order contained in the Record Group used by the LOV.
    e.g. Select ... From ... Where column = :block.radio_group ...Francois

  • How to set the bind variable on page load and execute query ?

    Hi All,
    I am using Jdeveloper 11.1.1.5
    I have a table called "Employee"
    Columns :- id , name , location
    Data :- 1, ,james , chicago
    2 ,Raj ,capetown
    Now i have another webservice(created as a webservice dataControl) which sends me the "id" on each time my page loads.Now the id which has been returned by webservice should be incorporated in my VO Query as in where clause to fetch the data for the respective "id" in that "Employee" table and should be rendered on form.
    Eg :- Id "2" has been sent by the webservice then the record should be fetched from database should be "2","raj","capetown".
    I know that there would be necessity of bind variable , but how do i set the bind variable on page load ?
    How can i use the bind variable appropriately ??
    Please suggest !!!!
    Thanks.

    Hi,
    Check
    http://www.orastudy.com/oradoc/selfstu/fusion/web.1111/b31974/web_services.htm#CJADCDBG
    http://thepeninsulasedge.com/frank_nimphius/2011/02/18/adf-code-corner-sample-73-released-hands-on-creating-a-search-form-using-a-pojo-ws-and-the-web-service-data-control/
    -Suresh

  • How to have the BIND variables value using the TKPROF utility.

    WE have a JAVA application and Oracle 9i database.We need to figure out what all select/update/insert sql staements are firing if i am doing one complete processing in my JAVA front application.
    Initally I have planned for using TKPROF utility after makeing AUTO_TRCE=TRUE in the database.But the problem is that all select/insert/update sql statements are using the BIND variables in the JAVA code and same is coming/printing on the trace file also.
    can we print out the BIND variables values also,while making the TRACE ON?
    eg: trace is generaitng the all insert statements like below.
    insert into TEST(Column1,Column2) values(:1,:2);
    I want to know the value of :1 and :2 bind variables.
    If you have any cluse about it please let me know.
    Mitesh Shah

    Thanks Guys,
    I got the BIND variable values in the TRACE file.Previously i was searching on the OUtputfile.
    I am pasting the same trce file format.Can you please verify it.Is i am looking the correct file and corect location.
    PARSING IN CURSOR #2 len=1571 dep=0 uid=66 oct=3 lid=66 tim=18446744071740803342 hv=1462188955 ad='123434f0'
    SELECT PARENTIDKEY,CONTRACTKEY,COMPANYKEY,BACKENDKEY,DATAREP,BANKHOLDINGID,BANKID,CARRIERPARTYID,PRODUCTID,ID,PREMIUMINDEXRATE,ILLUSTRATEDMATURITYLOW,ILLUSTRATEDMATURITYHIGH,SPECIALHANDLING,CARRIERCOMMCODE,MONEYTRANSFERTYPE,FIRSTBILLSKIPMONTH,CONTESTABILITYENDDATE,DEDUCTIONDATE,MARKETVALADJUSTIND,FREEAVAILABLEAMT,ADVANCINGREJECTEDIND,RATEDIND,OTHERINSUREDIND,ENDORSEMENTIND,BENEFICIARYIND,CASECONTROLNUMBERASSUMING,OWNERLEGALNAME,STAMPDUTY,COMMISSIONANNUALIZEDIND,NONSTDCOMMTAKEN,LAPSETAXABLEGAIN,GOVTALLOTMENTSUSPENSEACCTAMT,LASTNOGOODCHECKREASON,LASTNOGOODCHECKDATE,LASTCOIDATE,LASTDEDUCTEDEXPENSECHARGES,LASTDEDUCTEDCOICHARGES,STATEMENTBASIS,LASTNOTICETYPE,LASTNOTICEDATE,PAYMENTDUEDATE,LASTBANKCHANGEDATE,EFTENDDATE,BANKBRANCHNAME,BANKNAME,PAYMENTDRAFTDAY,BANKACCTTYPE,CREDITCARDTYPE,CREDITCARDEXPDATE,ACCTHOLDERNAME,ROUTINGNUMBER,ACCOUNTNUMBER,PAYMENTMETHOD,ANNUALPAYMENTAMT,PAYMENTAMT,PAYMENTMODE,LASTCOIANNIVDATE,BILLINGSTOPDATE,BILLEDTODATE,FINALPAYMENTDATE,GRACEPERIODENDDATE,PAIDTODATE,STATUSCHANGEDATE,REINSTATEMENTDATE,TERMDATE,ISSUEDATE,EFFDATE,DOWNLOADDATE,DURATION,POLFEE,POLICYVALUE,COMMISSIONROLLOVERPCT,COMMISSIONOPTIONSELECTED,REPLACEMENTTYPE,CUSIPNUM,CONVERTTOPRIVATEIND,PORTABILITYIND,REINSURANCEIND,BILLNUMBER,JURISDICTION,ISSUETYPE,ISSUENATION,STATUSREASON,PRIORPOLICYSTATUS,POLICYSTATUS,SHORTNAME,ADMINISTERINGCARRIERCODE,PLANNAME,FILEDFORMNUMBER,FORMNO,CARRIERCODE,PRODUCTCODE,PRODUCTTYPE,LINEOFBUSINESS,CERTIFICATENO,POLNUMBER,CARRIERADMINSYSTEM FROM "POLICY" WHERE PARENTIDKEY = :1 AND CONTRACTKEY = :2 AND COMPANYKEY = :3 AND BACKENDKEY = :4
    END OF STMT
    PARSE #2:c=0,e=1298,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=0,tim=18446744071740803336
    BINDS #2:
    bind 0: dty=1 mxl=4000(4000) mal=00 scl=00 pre=00 oacflg=01 oacfl2=0 size=4000 offset=0
    bfp=082a5a9c bln=4000 avl=09 flg=05
    value="Holding_1"
    bind 1: dty=1 mxl=4000(4000) mal=00 scl=00 pre=00 oacflg=01 oacfl2=0 size=4000 offset=0
    bfp=082a4af0 bln=4000 avl=10 flg=05
    value="DUL001138U"
    bind 2: dty=1 mxl=4000(4000) mal=00 scl=00 pre=00 oacflg=01 oacfl2=0 size=4000 offset=0
    bfp=069bb890 bln=4000 avl=02 flg=05
    value="00"
    bind 3: dty=1 mxl=4000(4000) mal=00 scl=00 pre=00 oacflg=01 oacfl2=0 size=4000 offset=0
    bfp=069ba8e4 bln=4000 avl=04 flg=05
    value="CLIF"
    **********************************************************************************

  • HOW to get the bind variables list.

    I've the following problem : I've some SQL queries stored in my DB as VARCHAR2 values.
    I need to use DBMS_SQL in order to execute them.
    In theese SQL statements I have some bind variables like :NUMORD. (ex. SELECT 'X' FROM YYYY WHERE FIELD_1 = :NUMORD).
    I don't know "a priori" names and number of such variables.
    Is there any way to have a list of such bind variables ?
    I found DBMS_DESCRIBE but is seems to act only on stored procedures/functions.
    I know I can tray to inspect the code looking for every ':' but a cleaner solution woulf be appreciated.
    Tks
    Tullio

    I don't know "a priori" names and number of such variables.
    Is there any way to have a list of such bind variables ?The names are probably not important, but you can get the count (and other useful information) like this:
    SQL> var cur refcursor
    SQL> declare
        cl clob;
    begin
        dbms_lob.createtemporary (cl, true);
        sys.utl_xml.parsequery (user, 'select e.deptno, :x x from emp e where deptno = :deptno', cl);
        open :cur for select cl cl from dual union all
                      select 'Count binds: ' || xmlquery('count(//BIND_VARIABLE)' passing xmltype(cl) returning content).getclobval() from dual;
        dbms_lob.freetemporary (cl);
    end;
    PL/SQL procedure successfully completed.
    SQL> print cur
    CL                                                                             
    <QUERY>                                                                        
      <SELECT>                                                                     
        <SELECT_LIST>                                                              
          <SELECT_LIST_ITEM>                                                       
            <COLUMN_REF>                                                           
              <SCHEMA>MICHAEL</SCHEMA>                                             
              <TABLE>EMP</TABLE>                                                   
              <TABLE_ALIAS>E</TABLE_ALIAS>                                         
              <COLUMN>DEPTNO</COLUMN>                                              
            </COLUMN_REF>                                                          
          </SELECT_LIST_ITEM>                                                      
          <SELECT_LIST_ITEM>                                                       
            <BIND_VARIABLE>1</BIND_VARIABLE>                                       
            <COLUMN_ALIAS>X</COLUMN_ALIAS>                                         
          </SELECT_LIST_ITEM>                                                      
        </SELECT_LIST>                                                             
      </SELECT>                                                                    
      <FROM>                                                                       
        <FROM_ITEM>                                                                
          <SCHEMA>MICHAEL</SCHEMA>                                                 
          <TABLE>EMP</TABLE>                                                       
          <TABLE_ALIAS>E</TABLE_ALIAS>                                             
        </FROM_ITEM>                                                               
      </FROM>                                                                      
      <WHERE>                                                                      
        <EQ>                                                                       
          <COLUMN_REF>                                                             
            <SCHEMA>MICHAEL</SCHEMA>                                               
            <TABLE>EMP</TABLE>                                                     
            <COLUMN>DEPTNO</COLUMN>                                                
          </COLUMN_REF>                                                            
          <BIND_VARIABLE>2</BIND_VARIABLE>                                         
        </EQ>                                                                      
      </WHERE>                                                                     
    </QUERY>                                                                       
    Count binds: 2                                                                 
    2 rows selected.

  • How to set a bind variable across the pages in a report

    I want to create a portal report where data will come from a table for a date range for a week.
    For e.g select event_date,last_name, event_name
    from RESOURCES
    where event_date between trunc(to_date(:curr_date,'DD-MON-RRRR'))
    and trunc(to_date(:curr_date,'DD-MON-RRRR')+ 7)
    The :curr_date is defined as a bind variable whose default value is sysdate.
    Now, when we run the report for the first time, it takes the :curr_date as
    sysdate and prints the report.
    I have two buttons in the report output like "previous week" and "next week".
    If someone presses previous week, the same report should run with curr_date
    as sysdate-7 and if someone presses next week, the report should run with
    curr_date as sysdate +7 and also the :curr_date sets to sysdate - 7 or sysdate + 7
    depending on the button pressed.
    Problem:
    How do I set the value of curr_date if someone presses any of
    previous week/next week.
    null

    Best to state your JDev version, and technology stack (eg. ADF BC) when posting.
    I can think of 2 approaches.
    1) Create a parent VO based on SELECT :bindVar FROM dual, then create links between your other VOs and the parent
    2) Create a AM client interface method that programatically sets the bind variable in each VO.
    Can you specify your use case? This one tends to come up when discussing effective from/to dated queries.
    CM.

  • How to set a bind variable into a vo query from the current vo ?

    I would like to exclude from my list of values defined in a view object the already referenced items in the current view object content.
    Let's say i have dept and emp with a many to many relationships, I would like that the already existing dept for emp not listed (excluded) in the list of values for emp.
    Do i need to define a bind parameters and set it during search or is it possible to use an expression that will refer the current row attribute representing the dept ?
    I didn't find an example or explanation how to set bind parameters defined in a view object query from seach pages or list of values ui components. May be somebody know how to find the info.
    Thank you

    I think that bind variable accessors in the VO class is what you need. You can override the getter method of the bind variable "LocaleCode2" in order to return the first 2 chars from the bind variable "LocaleCode". Have a look at this blog post for details:
    http://jdeveloperandadf.blogspot.com/2011/03/custom-java-bind-variable-in-where.html
    Dimitar

  • How to identify the variable processing type

    Hi Experts,
    How to find the details of the variable whether it is filling with user exit or replacement path
    Say i have a variable xxx , how to identify the above details.
    Thanks,

    use RSZGLOBV table in VNAM give your variable and VPROCTP will give you processing type

  • How to assign sessionscope variable to the bind variable in Query of VO

    Hi all,
    I want to know how to assign a sessionscope variable in the binvariable of Query in VO
    My sessionscope variable holds the value of currently selected column in the table. eg:empname of the currently selected column which is in empdetails table...
    I want display the schemes available for the selected employee in the next table..The schemes are in another table named empschemes which has the empname and empschemes as column
    I have created a vo for empschemes table with bind variable 'scheme_bind'..I need to set the sessionscope variable '#{sessionScope.empname}" to the bind variable.
    Its urgent,..Pls do reply asap
    Thanks in advance
    Nasrin

    HI,
    You can use
    adf.context.sessionScope.get("YourSessionVariable")this code for assigning VO's bind variable value.write this code where you create bind variable and do not forget click on expression radio button.
    Rafat

  • Extract the "bind" variables for a given query running in 10g.

    how can we extract the "bind" variables for a given query running in 10g? The performance of a query may vary based on the parameters supplied to it. For example, a query like the following
    SELECT * FROM CUSTOMER_ORDERS WHERE CUSTOMER = :CUST_ID
    .might run differently when the :CUST_ID is "123" who may have very few orders versus "456" who may have tens of thousands of orders.
    So, if we see a spike in the system due to a query, we need visibility into what the exact query syntax and values are for any database session. We're aware of an Oracle view called V$SQL_BIND_CAPTURE, but what we're finding with this view is that it's only a snapshot of variables that are refreshed on an interval. That view does not give us a live view into what values are being used in the various sessions in realtime.
    If someone ould provide us with some SQL (or other means) to do get a realtime view into the SQL and variables currently running in the database, it would be greatly appreciated.

    In addition to what's been said in the other thread, you could add a layer of logging either in the database or out.
    v$sql_bind_capture and the associated ash view dba_hist_sqlbind contain sample data.
    You could up the sample rate but it's not advisable - it's still just a sample.
    If you're on 11g, this is where adaptive cursor sharing might help.
    Not help in finding the values of your binds, but help in using different plans where there is such a skew for different bind values and the plan is perhaps wrong for customer 456.
    The problem when you're got such a skew and you're using bind variables is that the two don't really go together.
    When the query is next parsed and you've got bind variable peeking enabled, you might get the 123 plan is that is the bind value at parse time and then run into problems for 456 or even vice versa.
    See http://jonathanlewis.wordpress.com/2009/05/06/philosophy-1/ for a discussion on binds and histograms which reflects the reasons for using either.

  • Bind variable peeking does not work

    Oracle 9.2.0.8
    create table my_table (c number);
    create index i on my_table(c);
    declare
    par varchar2(10);
    begin
    par:='qqq';
    for rec in (select * from my_table t where c = par or par is null )loop null; end loop;
    --USES FULL TABLE SCAN, works SLOW!!!
    --but the same query with constat insted of bind variable :
    for rec in (select * from my_table t where c = par or 'qqq' is null )loop null; end loop;
    --USES INDEX i ON column c ,  works FAST!!!
    --WHY bind variable peeking does not work ???
    end;
    Thank you for reply

    sqlplus:
    drop table my_table;
    create table my_table as select object_name as c from all_objects where rownum<=1000;
    insert into my_table select * from my_table;
    insert into my_table select * from my_table;
    insert into my_table select * from my_table;
    insert into my_table select * from my_table;
    insert into my_table select * from my_table;
    insert into my_table select * from my_table;
    commit;
    select count(1) from my_table;
    COUNT(1)
    64000
    create index my_table_idx on my_table(c);
    exec dbms_stats.gather_table_stats('bogdanov','my_table',cascade=>true)
    variable par varchar2(10)
    exec :par := 'www'
    --FIRST CASE                                             
    explain plan for select * from my_table where c=:par or 'www'='qqq';
    @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | 64 | 1792 | 3 |
    |* 1 | INDEX RANGE SCAN | MY_TABLE_IDX | 64 | 1792 | 3 |
    Predicate Information (identified by operation id):
    1 access("MY_TABLE"."C"=:Z)
    --SECOND CASE                                             
    explain plan for select * from my_table where c=:par or :par='qqq';
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | 703 | 19684 | 95 |
    |* 1 | TABLE ACCESS FULL | MY_TABLE | 703 | 19684 | 95 |
    Predicate Information (identified by operation id):
    1 filter("MY_TABLE"."C"=:Z OR :Z='qqq')
    --THIRD CASE very strange....  COMPARE IT WITH FIRST CASE: 123456789 vs. 'qqq'    
    explain plan for select * from my_table where c=:par or 'www'=123456789;
    @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes | Cost |
    | 0 | SELECT STATEMENT | | 703 | 19684 | 95 |
    |* 1 | TABLE ACCESS FULL | MY_TABLE | 703 | 19684 | 95 |
    Predicate Information (identified by operation id):
    1 filter("MY_TABLE"."C"=:Z OR TO_NUMBER(:Z)=123456789)
    Edited by: user450084 on Dec 9, 2008 5:17 AM
    Edited by: user450084 on Dec 9, 2008 5:27 AM

  • Bind Variable Peeking Not Working

    Hello,
    I'm having an issue with a query I'm running in a stored proc.
    The BILLING_TRANS_LOG table is partitioned on orig_process_date and when I run the query with literals the plan makes use of the partitions, but when using values from the procedure parameters or bind variables the plan does not use them and takes a long time to return.
      SELECT btl.billing_trans_id 
    FROM compas.billing_trans_log btl, compas.billing_trans_log_alloc btla 
    WHERE
    btl.billing_trans_id = btla.billing_trans_id 
    AND btl.bank_routing_number = '123456789' 
    AND btl.bank_account_number = '222222222''
    --AND btl.orig_process_date BETWEEN '01-sep-2012' AND '07-sep-2012' 
    AND btl.orig_process_date BETWEEN :p_start_date AND :p_stop_date 
    AND btla.total_amount = 214.5;
    Does anyone know what I might do to force bind variable peeking so that the plan uses the partitions every time, or some other approach that would ensure the use of them?
    Thanks,
    Christine

    Dominic,
    Your suggestion of local non prefixed index seems interesting. I have tested it
    create table billing_trans_log
         (billing_trans_id     number
         ,orig_process_date    date
         ,bank_routing_number  number
         ,bank_account_number  number
    PARTITION BY RANGE (orig_process_date)
    PARTITION P_20121201 VALUES LESS THAN (TO_DATE(' 2012-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) ,
    PARTITION P_20121202 VALUES LESS THAN (TO_DATE(' 2012-12-02 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) ,
    PARTITION P_20121203 VALUES LESS THAN (TO_DATE(' 2012-12-03 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) ,
    PARTITION P_20121204 VALUES LESS THAN (TO_DATE(' 2012-12-04 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) 
    alter table billing_trans_log add constraint PK_BILLING_TRANS_LOG primary key (billing_trans_id);
    create table billing_trans_log_alloc (billing_trans_id number,total_amount number);
    create index IDX_BILLING_TRANS_LOG_ALLOC on billing_trans_log_alloc(billing_trans_id);
    SELECT btl.billing_trans_id
    FROM billing_trans_log btl
      , billing_trans_log_alloc btla
    WHERE
    btl.billing_trans_id = btla.billing_trans_id
    AND btl.bank_routing_number = '123456789'
    AND btl.bank_account_number = '222222222'
    AND btl.orig_process_date BETWEEN to_date('01122012','ddmmyyyy') AND to_date('02122012','ddmmyyyy')
    AND btla.total_amount = 214.5;
    | Id  | Operation                    | Name                        | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT             |                             |       |       |     2 (100)|          |       |       |
    |   1 |  NESTED LOOPS                |                             |       |       |            |          |       |       |
    |   2 |   NESTED LOOPS               |                             |     1 |    74 |     2   (0)| 00:00:01 |       |       |
    |   3 |    PARTITION RANGE ITERATOR  |                             |     1 |    48 |     2   (0)| 00:00:01 |     2 |     3 |
    |*  4 |     TABLE ACCESS FULL        | BILLING_TRANS_LOG           |     1 |    48 |     2   (0)| 00:00:01 |     2 |     3 |
    |*  5 |    INDEX RANGE SCAN          | IDX_BILLING_TRANS_LOG_ALLOC |     1 |       |     0   (0)|          |       |       |
    |*  6 |   TABLE ACCESS BY INDEX ROWID| BILLING_TRANS_LOG_ALLOC     |     1 |    26 |     0   (0)|          |       |       |
    Predicate Information (identified by operation id):
       4 - filter(("BTL"."BANK_ROUTING_NUMBER"=123456789 AND "BTL"."BANK_ACCOUNT_NUMBER"=222222222 AND
                  "BTL"."ORIG_PROCESS_DATE"<=TO_DATE(' 2012-12-02 00:00:00', 'syyyy-mm-dd hh24:mi:ss')))
       5 - access("BTL"."BILLING_TRANS_ID"="BTLA"."BILLING_TRANS_ID")
       6 - filter("BTLA"."TOTAL_AMOUNT"=214.5)
    Lets create the suggested local non prefixed index and re-execute the same query again
    create index local_non_prefixed_mho_ind on billing_trans_log (bank_routing_number,bank_account_number) local;
    | Id  | Operation                            | Name                        | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT                     |                             |       |       |     1 (100)|          |       |       |
    |   1 |  NESTED LOOPS                        |                             |       |       |            |          |       |       |
    |   2 |   NESTED LOOPS                       |                             |     1 |    74 |     1   (0)| 00:00:01 |       |       |
    |   3 |    PARTITION RANGE ITERATOR          |                             |     1 |    48 |     1   (0)| 00:00:01 |     2 |     3 |
    |*  4 |     TABLE ACCESS BY LOCAL INDEX ROWID| BILLING_TRANS_LOG           |     1 |    48 |     1   (0)| 00:00:01 |     2 |     3 |
    |*  5 |      INDEX RANGE SCAN                | LOCAL_NON_PREFIXED_MHO_IND  |     1 |       |     1   (0)| 00:00:01 |     2 |     3 |
    |*  6 |    INDEX RANGE SCAN                  | IDX_BILLING_TRANS_LOG_ALLOC |     1 |       |     0   (0)|          |       |       |
    |*  7 |   TABLE ACCESS BY INDEX ROWID        | BILLING_TRANS_LOG_ALLOC     |     1 |    26 |     0   (0)|          |       |       |
    Predicate Information (identified by operation id):
       4 - filter("BTL"."ORIG_PROCESS_DATE"<=TO_DATE(' 2012-12-02 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
       5 - access("BTL"."BANK_ROUTING_NUMBER"=123456789 AND "BTL"."BANK_ACCOUNT_NUMBER"=222222222)
       6 - access("BTL"."BILLING_TRANS_ID"="BTLA"."BILLING_TRANS_ID")
       7 - filter("BTLA"."TOTAL_AMOUNT"=214.5)
    It seems to be a  better plan.
    The local non prefixed index is suitable here because the query itself is doing a partition pruning (see this article for details about the attention one should make when creating a local non prefixed index).
    I pushed a little bit the test further and replaced the local non prefixed index by a local prefixed one and re-executed the query again
    drop index local_non_prefixed_mho_ind;
    create index local_prefixed_mho_ind on billing_trans_log
       (orig_process_date, bank_routing_number,bank_account_number) local;
    | Id  | Operation                            | Name                        | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT                     |                             |     1 |    74 |     0   (0)| 00:00:01 |       |       |
    |   1 |  NESTED LOOPS                        |                             |       |       |            |          |       |       |
    |   2 |   NESTED LOOPS                       |                             |     1 |    74 |     0   (0)| 00:00:01 |       |       |
    |   3 |    PARTITION RANGE ITERATOR          |                             |     1 |    48 |     0   (0)| 00:00:01 |     2 |     3 |
    |   4 |     TABLE ACCESS BY LOCAL INDEX ROWID| BILLING_TRANS_LOG           |     1 |    48 |     0   (0)| 00:00:01 |     2 |     3 |
    |*  5 |      INDEX RANGE SCAN                | LOCAL_PREFIXED_MHO_IND      |     1 |       |     0   (0)| 00:00:01 |     2 |     3 |
    |*  6 |    INDEX RANGE SCAN                  | IDX_BILLING_TRANS_LOG_ALLOC |     1 |       |     0   (0)| 00:00:01 |       |       |
    |*  7 |   TABLE ACCESS BY INDEX ROWID        | BILLING_TRANS_LOG_ALLOC     |     1 |    26 |     0   (0)| 00:00:01 |       |       |
    Predicate Information (identified by operation id):
       5 - access("BTL"."ORIG_PROCESS_DATE">=TO_DATE(' 2012-12-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  "BTL"."BANK_ROUTING_NUMBER"=123456789 AND "BTL"."BANK_ACCOUNT_NUMBER"=222222222 AND "BTL"."ORIG_PROCESS_DATE"<=TO_DATE('
                  2012-12-02 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
           filter("BTL"."BANK_ROUTING_NUMBER"=123456789 AND "BTL"."BANK_ACCOUNT_NUMBER"=222222222)
       6 - access("BTL"."BILLING_TRANS_ID"="BTLA"."BILLING_TRANS_ID")
       7 - filter("BTLA"."TOTAL_AMOUNT"=214.5)
    What I gained here is that there is no filter on the table BILLING_TRANS_LOG. The index became very precise having only an access predicate  
    Of course the test should be conducted under meaningful data volume to have an exact feeling about the new indexes
    Best regards
    Mohamed Houri

  • How to compute a bind variable from another?

    I am trying to create a View Criteria that has the following View Object Where Clause:
    (UPPER(LOCALE) = UPPER(:LocaleCode) ) OR (UPPER(LOCALE) = UPPER(SUBSTR(:LocaleCode,1,2)))
    In other words, I have a bind variable called LocaleCode, and I want to return all rows that either match the LocaleCode exactly (first part of the Where Clause), or match the first 2 characters of the LocaleCode value (second part of Where Clause).
    I can't seem to figure out any way to do this straight-up using the UI for a View Criteria - there doesn't seem to be a "substring" operator when adding an item to the clause.
    So, my thought was to create a second bind variable (e.g. "LocaleCode2") that was computed from the first bind variable (LocaleCode). This new bind variable would contain the first 2 characters from LocaleCode. I could then have the Where Clause be:
    (UPPER(LOCALE) = UPPER(:LocaleCode) ) OR (UPPER(LOCALE) = UPPER(:LocaleCode2))
    My problem is that when I define the LocaleCode2 bind variable, I see the option to set it to an Expression, but I can't seem to figure out how to build an expression that refers to another bind variable.
    So, my questions are:
    1. How can I have a bind variable expression refer to another bind variable (e.g. "LocaleCode2 = substring(:LocaleCode,1,2)" or something)?
    2. Is there a better way to do this altogether? (What I'm trying to do is set up a view criteria for a lookup table that will return rows that match a passed-in locale exactly (language and country), or just on the 'language' part (first 2 characters).)
    Thanks!

    I think that bind variable accessors in the VO class is what you need. You can override the getter method of the bind variable "LocaleCode2" in order to return the first 2 chars from the bind variable "LocaleCode". Have a look at this blog post for details:
    http://jdeveloperandadf.blogspot.com/2011/03/custom-java-bind-variable-in-where.html
    Dimitar

  • How to querie with bind variable in findMode?

    Hallo,
    is it possible to use a querie with bind variable in findMode? And when how is it possible to initialize the bind variable?
    Any help is appreciated.

    Hi,
    bind variables can be linked from teh ADF binding to e.g. a managed bean, the sessionScope or other binding attributes via EL. So when you go into findMode and execute the query, the EL will grab the bindVariable values automatically.
    Frank

Maybe you are looking for