query not given function function index in oracle 11g

I have a query that uses function based indexes when run in oracle 9i, but when I run the same query
without any change, it does not consider the index. This is the query:

SELECT distinct patient_role.domain_key, patient_role.patient_role_key,
patient_role.emergency_contact_name,
patient_role.emergency_contact_phone, patient_role.emergency_contact_note,
patient_role.emergency_contact_relation_id,
patient_role.financial_class_desc_id, no_known_allergies, patient_role. CREATED_BY,
patient_role. CREATED_TIMESTAMP,
patient_role. CREATED_TIMESTAMP_TZ, patient_role. UPDATED_BY, patient_role. UPDATED_TIMESTAMP,
patient_role. UPDATED_TIMESTAMP_TZ,
patient_role.discontinued_date
MEETING, patient_role
WHERE patient_role.patient_role_key = encounter.patient_role_key
AND SUPERIOR (TRIM (main: encounter.account_number SYS_B_0)) = UPPER (TRIM (main: SYS_B_1 of))
((: SYS_B_2))
AND patient_role.discontinued_date IS null
AND encounter.discontinued_date IS null;

Definition of the index:

CREATE INDEX "user1". "' IX_TRIM_ACCOUNT_NUMBER ' ON 'user1 '. MEETING"(AT THE TOP (TRIM (LEADING))
('0' TO 'ACCOUNT_NUMBER')), 'PATIENT_ROLE_KEY', 'DOMAIN_KEY', 'DISCONTINUED_DATE')
PCTFREE, INITRANS 10 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
DEFAULT USER_TABLES)
TABLESPACE "user1".

Database: Oracle 11g (11.2.0.3)
O / s: 64-bit Linux (the query does not consider the index even on the windows operating system)

Any suggestions?

-Onkar

Published by: onkar.nath on July 2, 2012 15:32

Onkar,

I don't appreciate posting you this issue in several forums at the same time.
If I know you also posted this on Asktom, I wouldn't even bother.
As for your "problem":
First of all: some kind cursor_sharing MUST have been implemented. Oracle is a predictable system, not a fruitmachine.
Anyway, your statement that '0' is replaced by a variable binding is simply false. If you really believe this isn't fake, SUBMIT an SR.

But your real problem isn't Oracle: it is your 'application', which is a mess anyway. Allowing for alphanumeric numbers is a very bad idea.
Now, you already put workaround on workaround on workaround on workaround.
Question is this: it is terminal, and you must either to kill him or to replace it.

-------------
Sybrand Bakker
Senior Oracle DBA

Tags: Database

Similar Questions

  • Function index in Oracle

    Hi gurus,

    Just trying to get some info in the function-based index.

    Can we have index created in the user-defined function?

    Lets say we have a table and I need a counter of a column. Could we have indexes on County?

    Select count (name) of employee

    WHERE name = "Hary";

    Thank you

    Tina

    The functions used in the function-based index must be DETERMINISTIC.

    Example you is not deterministic, that is given the input, the output can vary, because there might be 10 Harys today and 5 tomorrow.

    Deterministic functions always return the same value for the same entry.

    See: http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/function.htm#LNPLS1580

  • Query not using Full Scan Index

    Hello world

    I'm on 11.2.0.3.0 AIX 6.1.

    There is a query such as:

    Select: sys_b_0 | Count (distinct (column_name)) table;

    that goes for the analysis full table. The column was values separate only 104 with not NULL values. To save memory buffer gets, I created an index on the table with the column used in the query (i.e. whose distinct values are recovered).

    The problem is that even after the creation of indexes and force the flag index that it does not use the full scan of the index. The provided indication is correct in syntax and was the only clue in the query, so there is no question of conflicts with others.

    Can anyone suggest me what I might be missing?

    Thank you

    It seems to me that if print_branch_code is defined as nullable in the table. If this is the case, the optimizer goes for a sweep of index, even if there is no real NULL values

  • CBO bug or not, or else develop do not consider the function index

    SQL> create table test_fun_or as select object_id+sysdate id,object_name from        
    
      2  dba_objects;
    
    Table created.
    
    SQL> create index i_test_fun_or on test_fun_or(id,'a') nologging;   
    
    //I don't know why oracle consider it as function index
    
    Index created.
    
    SQL> create index i_test_fun_or_1 on test_fun_or(object_name) nologging;
    
    Index created.
    
    SQL> set autot trace exp
    
    SQL> exec dbms_stats.gather_table_stats(user,'TEST_FUN_OR',estimate_percent=>null,method_opt=>'for all columns size 1');
    
     
    
    PL/SQL procedure successfully completed.
    
     
    
    SQL> select * from test_fun_or where id=sysdate or object_name='aa';
    
     
    
    Execution Plan
    
    ----------------------------------------------------------
    
    Plan hash value: 3247456674
    
     
    
    ---------------------------------------------------------------------------------
    
    | Id  | Operation         | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
    
    ---------------------------------------------------------------------------------
    
    |   0 | SELECT STATEMENT  |             |     3 |    87 |   219   (3)| 00:00:03 |
    
    |*  1 |  TABLE ACCESS FULL| TEST_FUN_OR |     3 |    87 |   219   (3)| 00:00:03 |
    
    ---------------------------------------------------------------------------------
    
     
    
    Predicate Information (identified by operation id):
    
    ---------------------------------------------------
    
     
    
       1 - filter("OBJECT_NAME"='aa' OR "ID"=SYSDATE@!)
    
     
    
    SQL> select /*+ use_concat */ * from test_fun_or where id=sysdate or object_name='aa'; 
    
    //or expand don't use index i_test_fun_or
    
     
    
    Execution Plan
    
    ----------------------------------------------------------
    
    Plan hash value: 3161566054
    
     
    
    ------------------------------------------------------------------------------------------------
    
    | Id  | Operation                    | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    
    ------------------------------------------------------------------------------------------------
    
    |   0 | SELECT STATEMENT             |                 |     3 |    87 |   224   (3)| 00:00:03 |
    
    |   1 |  CONCATENATION               |                 |       |       |            |          |
    
    |*  2 |   TABLE ACCESS FULL          | TEST_FUN_OR     |     1 |    29 |   219   (3)| 00:00:03 |
    
    |*  3 |   TABLE ACCESS BY INDEX ROWID| TEST_FUN_OR     |     2 |    58 |     5   (0)| 00:00:01 |
    
    |*  4 |    INDEX RANGE SCAN          | I_TEST_FUN_OR_1 |     2 |       |     3   (0)| 00:00:01 |
    
    ------------------------------------------------------------------------------------------------
    
     
    
    Predicate Information (identified by operation id):
    
    ---------------------------------------------------
    
     
    
       2 - filter("ID"=SYSDATE@!)
    
       3 - filter(LNNVL("ID"=SYSDATE@!))
    
       4 - access("OBJECT_NAME"='aa')
    
     
    
    SQL> drop index i_test_fun_or;
    
     
    
    Index dropped.
    
     
    
    SQL> create index i_test_fun_or on test_fun_or(id,object_name) nologging;
    
     
    
    Index created.
    
     
    
    SQL> alter table test_fun_or modify object_name not null;
    
     
    
    Table altered.
    
     
    
    SQL> select /*+ use_concat */ * from test_fun_or where id=sysdate or object_name='aa';
    
     
    
    Execution Plan
    
    ----------------------------------------------------------
    
    Plan hash value: 1705821130
    
     
    
    ------------------------------------------------------------------------------------------------
    
    | Id  | Operation                    | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    
    ------------------------------------------------------------------------------------------------
    
    |   0 | SELECT STATEMENT             |                 |     3 |    87 |     8   (0)| 00:00:01 |
    
    |   1 |  CONCATENATION               |                 |       |       |            |          |
    
    |*  2 |   INDEX RANGE SCAN           | I_TEST_FUN_OR   |     1 |    29 |     3   (0)| 00:00:01 |
    
    |*  3 |   TABLE ACCESS BY INDEX ROWID| TEST_FUN_OR     |     2 |    58 |     5   (0)| 00:00:01 |
    
    |*  4 |    INDEX RANGE SCAN          | I_TEST_FUN_OR_1 |     2 |       |     3   (0)| 00:00:01 |
    
    ------------------------------------------------------------------------------------------------
    
     
    
    Predicate Information (identified by operation id):
    
    ---------------------------------------------------
    
        2 - access("ID"=SYSDATE@!)
    
       3 - filter(LNNVL("ID"=SYSDATE@!))
    
       4 - access("OBJECT_NAME"='aa')

    Jinyu wrote:
    Thanks Jonathan, I don't have 11.2.0.2 on-site, I'll test it later, I just test it on 11.2.0.1

    If you see the notes of fixed a bug fixes for 11.2.0.2 Group (Doc ID:1179583.1) it's bug 8352378 "allow index GOLD-Expansion functions.

    Concerning
    Jonathan Lewis

  • I am unable to access the Windows XP updates and unable to set up the automatic update. I have not given an error code. I was only told I can't perform these functions.

    I am unable to access the Windows XP updates and unable to set up the automatic update.  I have not given an error code.  I was only told I can't perform these functions.  I don't have the windows disk that the computer came preloaded with Windows and I don't remember the Administor password I created 5 years ago.  Can anyone help?

    Assume that:

    http://support.Microsoft.com/kb/316524

    You receive an error message 'Administrators' only when you try to visit the Windows Update Web site or the Microsoft Update Web site

    http://support.Microsoft.com/kb/189126

    Microsoft's strategy concerning lost or forgotten passwords

    What I can offer: http://support.microsoft.com/kb/321305

    How to connect to your Windows XP-based computer if you forget your password or if your password expires

  • How we force a query to use transparently a hint, even if the index is not given in the query as a query rewriting.

    How we force a query to use transparently a hint, even if the index is not given in the query as a query rewriting.

    For example:

    If the user runs a query select deptno, avg (sal) from emp group by deptno;

    We want the optimizer to use a hint of result_cache with this request, and it should be transparent to the user.

    Query should be rewritten to seamlessly

    Select / * + result_cache * / deptno, avg (sal)

    WCP

    Group of deptno;

    How can this feature we make? Please advice.

    I checked the possibility of SPM and contours, but it is not clear if this rewrite is possible here.

    Thank you and best regards,

    Vikas Krishna

    Surely dbms_advanced_rewrite is designed for this situation?

  • Function Index

    I'm reviewing an existing table in a database Oracle 11g and I do not understand a function based index that was created. The syntax is less than

    CREATE INDEX abc. Orders_Date on abc. ORDERS

    (CASE WHERE "ORDER_DATE" IS NOT NULL THEN "ORDER_DATE" ELSE NULL END)

    LOGGING;

    This table has about 90 000 lines with 32 000 values distinct order_date, 3000 lines have order_dates null. When you run a query on this table using the order_date column it makes a full table scan.

    What does this function index based? because I do not see how it adds all the required features

    Thank you

    As others have said, this index is actually right on order_date, however, is a core function so it cannot be used in queries that use CASES WHEN "ORDER_DATE" IS NOT NULL THEN END NO OTHER "ORDER_DATE."

    It is assumed that it might be possible that there is an index on (order_date) but it was found that it was used in the sql queries, which would have preferred to use other indexes. Some queries benefits so maybe that option based function was created as the sql must refer to the phrase exactly, requests that have received have been rewritten and others were left so that they could avoid the new index of the index.

    Of course, if this were the case then maybe you can take a look at your stats.

  • Function table in oracle

    Hi all

    I am using Oracle 11g

    I want to know in order to learn

    What is the CURSOR in the function table.

    What is its usefulness

    Can someone explain to me.

    SELECT x.*

    (TABLE (package1.function1)

    CURSOR (SELECT

    t.*

    OF test1 t))) x

    Thank you

    What is the CURSOR in the function table.

    What is its usefulness

    Can someone explain to me.

    SELECT x.*

    (TABLE (package1.function1)

    CURSOR (SELECT

    t.*

    OF test1 t))) x

    This slider is NOT 'in the function table. It is in the call to YOUR function named "packagae1.function1" and the function returns a collection. If it is the result of the collection of YOUR function call which is 'in the function table.

    Your probable function takes a REF CURSOR as a parameter, so the code above uses the CURSOR operator to create a cursor from a subquery.

    Your function then returns a collection and SCOREBOARD operator is used to make this collection available in SQL.

    See FUNCTIONS TABLE in the Oracle documentation. A simple search for 'oracle 11g table function' returns the Oracle doc as the FIRST result listed:

    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28425/pipe_paral_tbl.htm

    This chapter describes the functions of table

    . . .

    Overview of the functions of table

    Table functions are producing a set of lines (a nested table or a varray) that can be queried as a physical database table. You use a function table as the name of a database table, in the FROM clause of a query.

    A table function can take a set of input lines. A parameter of the input collection can be of a collection type or a REF CURSOR .

    . . .

    Look at the examples 5-13 and 13-6, because they show the code for your EXACT example:

    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28425/pipe_paral_tbl.htm#CIHEGADE

    . . .

    Example 13-6 How to use a function Table in pipeline with REF CURSOR Arguments

    SELECT * FROM TABLE(StockPivot(CURSOR(SELECT * FROM StockTable)));
    

    In the previous query, the function table in pipeline StockPivot retrieves the lines of the CURSOR subquery SELECT * FROM StockTable , performs the transformation and channels the results to the user in the form of table. The function produces two lines of output for each input line (items in the collection).

    Note that when a CURSOR subquery went from SQL for a REF CURSOR argument of function as in the previous example, the referenced cursor is already open when the function begins to run.

    As the doc example, as in your example, a subquery of CURSOR to create a cursor to be used as a function parameter. Example 13 - 5 has the actual code for the function.

    The documentation is your FRY - don't be afraid to use it.

    If you try to learn something a good question to ask on the forums is: where can I get more information about the functions of the table (or other topic).

    Then, we can direct you to the Oracle documentation that covers this topic.

  • Function Index problem.

    Hello

    I have a problem regarding a function function index.

    example:

    TableName: Test

    Column: A, B, C, D

    I create the index on the table, column, a test using a user-defined function.

    If I do a select on the column, he'll be fine. In other words, I'll get the results you want.

    However, if I insert in the table and validation, and I do a query using the 'A' column in the where clause. I don't have any query hits. Its really weird.

    Have you ever experienced this problem? and is there an index of function according to back and donts w.r.t.?

    Thank you.

    MichaelR

    If you use a deterministic function really, it works:

    create or replace function test_fn (p_number number) return number deterministic
    is
      vreturn number := 0;
    begin
      if p_number = 1 then vreturn := 55; end if;
      if p_number = 2 then vreturn := 89; end if;
      return vreturn;
    end;
    

    Or, if you reverse the order of your second inserts (insert the folder before the recording of test1 test2) - it works fine.

    The reason why you get no results is when you insert the file test1 with a = 2, Oracle executes the function and gets no data, so it assumes that the result is NULL and puts in the index. You said Oracle function is deterministic, so he starts from the principle that any time test_fn (2) is called, it retrieves a null response.

  • 12.1.3 extension XSLT editor Query-database mapping function

    Hello

    , We are trying to move from 11.1.1.7 to 12.1.3 JDeveloper. We have developed a number of xsl maps in 11.1.1.7 using the function oraext:query - database Oracle extension (where the namespace oraext is xmlns:oraext ="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc" "). This works in JDeveloper 11.1.1.7 when the test of the card where the call to the map looks like this:

    < xsl: value-of select = "oraext:query - database (concat (& quot; Select fvalue GetMapCodeList ("param1", "param2", "param3") of double, quot;), false (), false (), & quot;jdbc:oracle:thin:dbuser/dbpassword@dbhost:1521:dbservicename & quot;) "/ >"

    In the statement select above is "select GetMapCodeList" which is a function defined in the database which takes 3 parameters. This works very well for us in 11.1.1.7. We are new to 12.1.3 and we get an error test map XSLT in JDeveloper. The error is

    file:/[file path] / [file name] .xsl: XML-22044: function (error) Extension error: Error invoking 'queryDatabase':'java.lang.NoClassDefFoundError: oracle/jdbc/OracleConnection '.

    It seems that it cannot find the ojdbc6.jar file, but I don't see where that should be added.

    Edit:

    OK, I realized that the extension functions XPath of Oracle do not appear in my XSLT Map Editor component palette. I also see that when I change the XPath of the oraext:query - database is highlighted by JDev as being invalid. I think my problem is with the extension being not loaded XPath functions.

    Thanks in advance.

    Steve

    OK, after working with the support of the Oracle, the answer is that the ojdbc6.jar did indeed need to be added to the configuration of JDeveloper 12.1.3. To do this the following line was added at the end of the jdev.conf file:

    AddVMOption - Xbootclasspath/r:... /... /.. /oracle_common/modules/Oracle.jdbc_12.1.0/ojdbc6.jar

    The jdev.conf file is located in your Oracle_Home\jdeveloper\jdev\bin directory. Don't forget to adjust the relative path to match your environment. In addition, please note that the only spaces in the AddVMOption line are a space immediately after "AddVMOption".

    Another concern in this thread that the functions of data base in the XPath Group advanced components from the component Palette was missing. The groups Advanced general XPath XPath and XSLT components model will appear only in the component Palette if the application is a SOA application.

    A score more. I don't know if Oracle sees this as a bug and the ojdbc6.jar to be in the classpath without the user set it up like that in the jdev.conf. If it's a bug, and then if all goes well it will be resolved in a future release, and this configuration will be necessary.

  • number of $ is not a function

    Hello

    I try to use the number of jquery plugin https://github.com/teamdf/jQuery-number/

    I work with apex oracle 4.2

    in the shared components, I import the file static jquery.number.js

    in my page, in the URL of the javascript file, I add

    < script src = "" #WORKSPACE_IMAGES #jquery.number.js "type =" text/javascript"> < / script >"

    and to run when the Page loads.

    I put

    try {}

    var DD = $nombre (300, 1, ', ' ' ");

    Alert (jj);

    }

    {catch (Err)}

    Alert (Err);

    }

    When I run the page I got the error TypeError: $nombre is not a function.

    I don't know why.

    any help?

    concerning

    Jean-Marc

    Copied from the 'help' on the URL "Javascript > file.

    Enter the URL of the JavaScript file for the code to load this page. Each URL must be entered in a new line. If you provide a compressed version of your file, you can use the substitution string #MIN# to include .min in the URL of your file for a standard page view and an empty string if the page is displayed in debug mode. You also have access to the substitution string #APP_VERSION# If you want to include the version of the application in the URL of the file.

    URL of the JavaScript file you enter here replace him #PAGE_JAVASCRIPT# in the page template substitution string.

    Note: You don't need to include the opening or closing script tags. Just write the URL.

    Examples:

    • The standard file reference
    • /myjs/main.js
    • Reference standard file that loads the main.min.js file compressed to regular page views and main.js in debug mode.
    • /myjs/main#min#.js
    • Conditional file for Internet Explorer
    • [if IE]/myjs/ie.js
    • File reference using a query string in the URL referring to the version of the application, such that when the application is upgraded (and the version is incremented), the browser is to always load the new file and ignore all files previously updated cache.
    • /myjs/main.js?version=#APP_VERSION#

    So: Your include file is incorrect. Just add

    #WORKSPACE_IMAGES#jquery.number.js
    

    for the URL

  • EXC in ev handl: TypeError: this.oRoot.enable is not a function that is popping up when I befor I open my browser in a box pop up under the heading JAVA SCRIPT EXE. That is - what, how can I get rid of him?

    TypeError: this.oRoot.enable is not a function

    This is popping up when I befor I open my browser,in a pop up box under the heading JAVA SCRIPT EXE. What is it, how do I get rid of it?
    

    For me, this happened from disabling, but do not uninstall McAfee site Advisor. Recommend site completely uninstalled and the problem disappeared completely. I had turned off before site Advisor, but it seems after a update to McAfee, he was back and then turn it off again caused this problem.

    Go to "uninstall a program" or "add/remove programs" in control panel. Find McAfee in your list (McAfee total protection for me). Click it and then click "Uninstall/Change" (right there in XP, up above in Vista or 7). I don't remember exactly what you see after that, but at one screen I was given the choice to uninstall the McAfee total protection and/or the Site Adviser. You can just check the Site Adviser and just uninstall the Site Adviser while retaining the rest of the McAfee protection.
    

    Good luck!

  • What is the best way to optimize a SQL query: call a function or doing a join?

    Hi, I want to know what is the best way to optimize a SQL query, call a function inside the SELECT statement, or make a simple join?

    It depends on.  Could be a.  Could be the other.  Could be no difference.  You would need to compare with your tables in your environment with your settings.

    If you put a gun to my head, I was given no other information and required that I answered the question, I would tend to wait that the join would be more effective.  In general, if you can do something in pure SQL, it will be more effective than if you call PL/SQL.

    Justin

  • MuseJSAssert: Error calling the function switch: TypeError: $(...). toBrowserWidth is not a function only on Firefox Cookies are erased and problem not solved.

    Receive error message

    MuseJSAssert: Error calling the function switch: TypeError: $(...). toBrowserWidth is not a function

    only on Firefox

    for the url

    www.tx4you.com/index.html

    Please help

    browsererroroct2014.png

    Clear the cache of Firefox (no cookies). Preferences > advanced > cached Web Content click clean now. FWIW, loading the page just fine for me in Firefox.

  • Based on a function index

    Hi all

    Based on a function index are recommended to sql queries slow poor acceleration?


    Thank you

    Kinz

    The only thing that a function index based (FBI) is intended is so you don't lose the use of an index when you call a function in your WHERE (predicate) clause.

    Not sure, I would say it was "the only thing"...

    How about you, the ability to provide access to a very small percentage of rows that match a certain condition (using DECODE or CASE) effective index?

Maybe you are looking for