Function Indexes

Does anyone know how to create an index using a function like UPPER, and then getting Oracle to use the index when issuing a SELECT statement using UPPER in the WHERE clause?

They're available in EE only. Same with bitmap indexes too.

Similar Messages

  • Function Index with Upper

    I am trying to use a function index and am having trouble. I built the index successfully using the syntax:
    CREATE INDEX COUNTRY_INDX1 ON COUNTRY(Upper(country_name));
    Then, I submitted a query such as:
    SELECT * FROM COUNTRY WHERE country_name = 'USA';
    I computed EXPLAIN PLAN and it still does a FULL access of the table. If I do something like Upper(country_name) in the where clause, it still doesn't find the correct index.
    Do I need to form my query differently to use the Function Index I created?
    Thanks so much in advance!!!

    SQL> desc emp
    Name                                      Null?    Type
    EMPNO                                              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> create index idx_emp_ename on emp(upper(ename)) ;
    Index created.
    SQL> analyze table emp compute statistics for table for all indexed columns ;
    Table analyzed.
    SQL> exec dbms_stats.set_table_stats(user, 'EMP', numblks => 100000) ;
    PL/SQL procedure successfully completed.
    SQL> set autotrace traceonly
    SQL> select * from emp where upper(ename) = 'A%' ;
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=60 Card=1 Bytes=40)
       1    0   TABLE ACCESS (BY INDEX ROWID) OF 'EMP' (Cost=60 Card=1 Byt
              es=40)
       2    1     INDEX (RANGE SCAN) OF 'IDX_EMP_ENAME' (NON-UNIQUE) (Cost
              =2 Card=1)
    SQL>

  • Issue with using N'...' values in a where clause against a function index

    We have a table that is defined with non Unicode columns with a UPPER(..) function index on the index column (to allow searching in any alphabetic case)
    e.g.
    create table my_table
    index_column varchar2(20),
    desc_column varchar2(40)
    create index my_table_idx as on my_table(UPPER(index_column));
    there is approx. > 10 million rows in this table
    The issue we have is that when we do the following select
    select index_column, desc_column from my_table
    where upper(index_column) = 'SOME VALUE'; this statement runs in approx 0.03 seconds which is great
    But we also have some statements that run as
    select index_column, desc_column from my_table
    where upper(index_column) = N'SOME VALUE'; notice the N'...' string (unicode) value used. This ends up doing a full table scan (> 5 seconds)
    So... the question is how can i make this select statement passing in a Unicode string value hit this function based UPPER index? Is there anyway?
    I have tried these extra indexes - to no avail
    create index my_table_idx as on my_table(UPPER(CAST(index_column as nvarchar2(20)));
    and
    create index my_table_idx as on my_table(UPPER(COMPOSE(index_column)));
    I assumed Oracle should have done and implicit conversion back to a non unicode string value and then passed that value into the UPPER(...) function index, but it appears as though Oracle isn't recognizing that the column is a different type (varchar2 vs nvarchar2)
    Any help greatly appreciated?

    Horrible amount of irrelevant tags, and the only thing relevant , the four digit version, is of course not mentioned.
    Also the characterset of the database is relevant.
    As far as I know in 11g and higher one no longer needs the N'<string construct>'
    As to implicit conversion
    assume <number_column> = '9'
    Oracle always converts this into
    to_char(<number_column>='9'
    Same applies to your case.
    Try leaving out the N, check whether it works and whether your function based index is used.
    Sybrand Bakker
    Senior Oracle DBA

  • Checking a functional index on a table and its metadata

    Hi,
    I have a functional based normal index (unique) defined on a table which uses a decode function and a combination of the columns of a table.
    Eg : decode (status, 'A', column1 || column 2, column1 || column2 || column3)
    Now my question is, how do we query these functional indexes from the database to see what exactly the function is...
    On the database when I run a query :-
    select from all_indexes where index_name = :index_name,*
    it retrieves the code name of the index stored as ncs$00025 (don't remember the exact value).
    How do I find out what exactly the function is? (from which table)
    and is there any way that I can query the data that has been indexed by this unique index so that I can verify why the unique constraint is being violated in some cases?
    Thanks and Regards,
    Suyash

    how do we query these functional indexes from the database to see what exactly the function is...
    select * from user_ind_expressions

  • Privilege need to create functional index

    Greeting gurus?
    What privilege I needed for create functional index
    I am writing a definer righted procedure to create index however when creating functional index, it gives me ora-0131 insufficent but unique, bitmap and reverse index works
    and I granted create any index and create any indextype already. what else is missing ?

    CREATE INDEX
    To create a function-based index, in addition to the prerequisites for creating a conventional index, if the index is based on user-defined functions, then those functions must be marked DETERMINISTIC. Also, you must have the EXECUTE object privilege on any user-defined function(s) used in the function-based index if those functions are owned by another user.

  • Maintaining functional index.

    Hi ,
    I have created a functional index on a huge table.the problem is every time
    if function gets updated , index will be disabled and even the select queries will
    fail giving exception.Can there be any effective way of maintaining the index??

    Presumably there is a person modifying the function in the (hopefully) rare case that it needs to be changed. It should be a part of your change control procedures that any modifications to this function means that the index needs to be re-built.
    I may be wrong, but I do not see any way to automatically re-build an index when the function it is based on changes.
    John

  • Version 4.0.0.12 (EA) - functional indexes of a table are listed twice

    Hello,
    it seems that functional indexes are listed twice if there are two functions within the index columns.....
    Example (Content from the indexes tab of the table view):
    owner    ....._PK    UNIQUE    VALID    NORMAL    N    NO
    NO    ....._UUID 
    owner    ....._UI1    UNIQUE    VALID    FUNCTION-BASED NORMAL    N    NO    ENABLED    NO    SYS_NC00016$, SYS_NC00017$, ....._ID, ....._PLAN_ID    SYS_EXTRACT_UTC("....._START")
    owner    ....._UI1    UNIQUE    VALID    FUNCTION-BASED NORMAL    N    NO    ENABLED    NO    SYS_NC00016$, SYS_NC00017$, ....._ID, ....._PLAN_ID    SYS_EXTRACT_UTC("....._END")
    Both functions are in the same index "....._UI1".
    The detail panel shows the same details.

    MPf_dba&amp;amp;dataGmbH wrote:
    Hello,
    it seems that functional indexes are listed twice if there are two functions within the index columns.....
    Example (Content from the indexes tab of the table view):
    owner    ....._PK    UNIQUE    VALID    NORMAL    N    NO 
    NO    ....._UUID  
    owner    ....._UI1    UNIQUE    VALID    FUNCTION-BASED NORMAL    N    NO    ENABLED    NO    SYS_NC00016$, SYS_NC00017$, ....._ID, ....._PLAN_ID    SYS_EXTRACT_UTC("....._START")
    owner    ....._UI1    UNIQUE    VALID    FUNCTION-BASED NORMAL    N    NO    ENABLED    NO    SYS_NC00016$, SYS_NC00017$, ....._ID, ....._PLAN_ID    SYS_EXTRACT_UTC("....._END")
    Both functions are in the same index "....._UI1".
    The detail panel shows the same details.
    What version of SQL*Developer?
    I am using 3.2.20.09 and created 2 function-based indexes on a practice employee table, upper() on both first and last names.  When displaying indexes through the table display using the Indexes tab and through the object navigator using indexes I only see each index once.
    On a second pass I created a third composite index with upper on both first and last names and got the results similar to those you describe in both places.  The column names (expression name in the table index pane) were different.

  • 9i Standard Ed has "functional index"?

    According to Oracle White Paper "Oracle9i Database Product Family", 9i SE has "functional index" feature. But V$OPTION in a complete 9i SE installation tells otherwise. Anyone knows why?
    Also, "Managed Standby" is not available in 9i SE either.

    Your posting doesn't seem to be related to how to do something in Web Dynpro. This formum isn't intended for all questions about any application that might happen to be implemented in WDA.  If your question is more about how the inner functionality of a business transaction works, there are other forums where you would have a higher chance of receiving a better response.

  • Crash in evaopn2 with functional indexes

    Hi,
    I have a problem with 3rd party application running on oracle 10.2.0.3. When a particular statement is executed, it triggers error in evaopn2.
    As far as I know, there was a bug using functional indexes, but it was supposed to be fixed in 10.2.0.3, right?
    Oracle is running on ubuntu server 7.10. This is the only problem we have so far.
    What should I do?
    Regards
    Jernej
    Trace dump:
    Exception signal: 11 (SIGSEGV), code: 1 (Address not mapped to object), addr: 0x0, PC: [0x9616d1a, evaopn2()+104]
    Registers:
    %eax: 0x0000013c %ebx: 0x00000000 %ecx: 0xb6db8f6c
    %edx: 0x3afe7144 %edi: 0x00000000 %esi: 0x80000002
    %esp: 0xbffd23f0 %ebp: 0xbffd25b0 %eip: 0x09616d1a
    %efl: 0x00200246
    evaopn2()+86 (0x9616d08) test $0x20800400,%esi
    evaopn2()+92 (0x9616d0e) jnz 0x9616f21
    evaopn2()+98 (0x9616d14) mov %ebx,0xfffffffc(%ebp)
    evaopn2()+101 (0x9616d17) mov 0x28(%edx),%ebx
    evaopn2()+104 (0x9616d1a) mov (%ebx),%esievaopn2()+106 (0x9616d1c) movzw 0x4(%ebx),%edi
    evaopn2()+110 (0x9616d20) mov (%esi,%ecx),%ebx
    evaopn2()+113 (0x9616d23) mov %edi,0xffffffe8(%ebp)
    evaopn2()+116 (0x9616d26) mov %ebx,0xfffffff0(%ebp)
    *** 2008-05-31 01:52:24.592

    What should I do?Contact 3rd party product vendor. An OS exception is thrown in the application, that may be a 3rd party problem, may be an Oracle problem, may be a combination of both. Only the code developers can analyze this.
    Werner

  • SOA Tablespace PITR - 'Domain/Functional Indexes not supported'

    Hi all,
    Trying to recover tablespaces from a failed 12c upgrade attempt.
    I have multiple backups prior to the upgrade attempt but it seems I can't perform a point in time recovery of the specific tablespaces due to the following:
    MDS & SOAINFRA > Domain/Functional Indexes not supported
    ORASDPM > Object not allowed in Recovery Set
    Has anyone done this? How did you get around it?

    I checked, this index is function_based...
    thank yoiu
    its DDL:
    CREATE INDEX SBSECD1_MDS.MDS_PATHS_N7 ON SBSECD1_MDS.MDS_PATHS
    (PATH_FULLNAME, "PATH_LOW_CN" DESC, PATH_HIGH_CN, PATH_PARTITION_ID)
    LOGGING
    TABLESPACE SBSECD1_MDS
    PCTFREE 10
    INITRANS 2
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    FLASH_CACHE DEFAULT
    CELL_FLASH_CACHE DEFAULT
    NOPARALLEL;

  • Dblink + local function: INDEX RANGE SCAN not used

    Hi All,
    I have an sql query to remote database:
    SELECT N FROM [email protected] WHERE cd_n = 60
    It works with INDEX RANGE SCAN for "N" field of table "tab", it's ok.
    Now I'm replacing the constant value with the local database function:
    SELECT N FROM [email protected] WHERE cd_n = dannis.foo()
    Then 'INDEX RANGE SCAN' is removed out from query execution plan :-(
    I've tried some tricks as
    /*+ rule index(user.tab TAB$PK) */,
    driving_site(tab),
    to_number(dannis.foo()),
    (select dannis.foo from [email protected])
    and so on...
    but INDEX RANGE SCAN wasn't appear while using the local function.
    Is it true when dblink is used in combination with local function then INDEX RANGE SCAN will never used?
    /Oracle 9.0.1.2/
    Thanx,
    dannis.

    See Optimizer not taking the hint

  • Determining Column name involve in Functional Index

    I write this query to know about the existing indexes of all tables pertains to a schema. My problem is when index is functional one, column name is not descriptive, it is like SYS_NC00047$, ..... as yet i could not find the way to know exact column name in the out put of this query. your help is required..
    SELECT index_owner,
             index_name,
             table_owner,
             table_name,
             column_name,
             column_position,
             column_length
        FROM dba_ind_columns
       WHERE index_owner = 'CORE_BUSINESS'
    ORDER BY table_name               ;

    Use DBA_IND_EXPRESSIONS or USER_IND_EXPRESSIONS.
    See this example :
    SQL> drop table X_1 purge;
    Table dropped.
    SQL>  create table X_1 (col_1  varchar2(5), col_2 number);
    Table created.
    SQL> create index X_1_UPPER_COL_1 on X_1(upper(col_1));
    Index created.
    SQL> set long 20000
    SQL> select column_expression from user_ind_expressions
      2  where index_name = 'X_1_UPPER_COL_1';
    COLUMN_EXPRESSION
    UPPER("COL_1")
    SQL>Note : COLUMN_EXPRESSION is a LONG datatype and SET LONG defaults to 80 in SQLPlus, thus it will only show the first 80 characters of the expression unless you SET LONG to a higher value.
    Hemant K Chitale

  • Functional Indexes "Disabled"

    Hello,
    Today our application users reported an issue at around 10am that when they are going to save the transactions they are getting error. When we go through the application log we get the following kind of error messages reported there continously:
    ORA-30554: function-based index <index_name> is disabled
    When i checked the funcidx_status column of dba_indexes table the value was "DISABLED". The point is that my application was running smoothly and fine till around 10am today then how these indexes got disabled???
    Please answer me in following points:
    1. What are the possible reasons of the indexes' disabled?
    2. How I can get the information about who worked on this?
    and other questions regarding "audit point of view" although audit feature is not being used.
    However, I have changed the status of indexes to enable and everything goes fine. But need help from you experts to find the cause of the issue.
    Regards,

    Vitula demersa, puteum completur.
    And even if one needs to close the well, documentation is not being read, and four digit version is not being mentioned.
    Sorry I just escaped Emperor Nero's jail and I have been severely tortured. Where you when you posted this?
    Sybrand Bakker
    Senior Oracle DBA

  • Oracle 9i Release 2 Function Index

    Can somone please tell me if functional indices are available on the standard 9i version or the Enterprise version only?
    I know they are enterprise only on 8i and I'm hoping this changed to 9i
    Thank you
    John D

    It seems to be included in 9i Standard edition see here
    http://otn.oracle.com/products/oracle9i/pdf/o9i_family_features.pdf

  • Function-based index with OR in the wher-clause

    We have some problems with functin-based indexes and
    the or-condition in a where-clause.
    --We use Oracle 8i (8.1.7)
    create table TPERSON(ID number(10),NAME varchar2(20),...);
    create index I_NORMAL_TPERSON_NAME on TPERSON(NAME);
    create index I_FUNCTION_TPERSON_NAME on TPERSON(UPPER(NAME));
    The following two statements run very fast on a large table
    and the execution-plan asure the usage of the indexes
    (-while the session is appropriate configured and the table is analyzed):
    1)     select count(ID) FROM TPERSON where upper(NAME) like 'MIL%';
    2)     select count(ID) from TPERSON where NAME like 'Mil%' or (3=5);
    In particular we see that a normal index is used while the where-clause contains
    an OR-CONDITION.
    But if we try the similarly select-statement
    3)     select count(ID) FROM TPERSON where upper(NAME) like 'MIL%' or (3=5);
    the CBO will not use the function-index I_FUNCTION_TPERSON_NAME and we have a full table scan in the execution-plan.
    (This behavior we only expect with views but not with indexes.)
    We ask for an advice like a hint, which enable the CBO-usage
    of function-based indexes in connection with OR.
    This problem seems to be artificial because it contains this dummy logic:
         or (3=5).
    This steams from an prepared statement, where this kind of boolean
    flag reduce the amount of different select-statements needed for
    covering the hole business-logic, while using bind-variables for the
    concrete query-parameters.
    A more realistic (still boild down) version of our select-statement is:
    select * FROM TPERSON
    where (upper(NAME) like 'MIL%' or (NAME is null))
    and (upper(FIRSTNAME) like 'MICH% or (FIRSTNAME is null))
    and ...;
    thank you for time..
    email: [email protected]

    In the realistic statement you write :
    select * FROM TPERSON
    where (upper(NAME) like 'MIL%' or (NAME is null))
    and (upper(FIRSTNAME) like 'MICH% or (FIRSTNAME is null))
    and ...;
    as far as i know, NULL values are not indexed, "or (NAME is NULL)" have to generate a full table scan.
    HTH
    We have some problems with functin-based indexes and
    the or-condition in a where-clause.
    --We use Oracle 8i (8.1.7)
    create table TPERSON(ID number(10),NAME varchar2(20),...);
    create index I_NORMAL_TPERSON_NAME on TPERSON(NAME);
    create index I_FUNCTION_TPERSON_NAME on TPERSON(UPPER(NAME));
    The following two statements run very fast on a large table
    and the execution-plan asure the usage of the indexes
    (-while the session is appropriate configured and the table is analyzed):
    1)     select count(ID) FROM TPERSON where upper(NAME) like 'MIL%';
    2)     select count(ID) from TPERSON where NAME like 'Mil%' or (3=5);
    In particular we see that a normal index is used while the where-clause contains
    an OR-CONDITION.
    But if we try the similarly select-statement
    3)     select count(ID) FROM TPERSON where upper(NAME) like 'MIL%' or (3=5);
    the CBO will not use the function-index I_FUNCTION_TPERSON_NAME and we have a full table scan in the execution-plan.
    (This behavior we only expect with views but not with indexes.)
    We ask for an advice like a hint, which enable the CBO-usage
    of function-based indexes in connection with OR.
    This problem seems to be artificial because it contains this dummy logic:
         or (3=5).
    This steams from an prepared statement, where this kind of boolean
    flag reduce the amount of different select-statements needed for
    covering the hole business-logic, while using bind-variables for the
    concrete query-parameters.
    A more realistic (still boild down) version of our select-statement is:
    select * FROM TPERSON
    where (upper(NAME) like 'MIL%' or (NAME is null))
    and (upper(FIRSTNAME) like 'MICH% or (FIRSTNAME is null))
    and ...;
    thank you for time..
    email: [email protected]

Maybe you are looking for

  • Not able to connect to Data service on Airtel

    Hi! I have a nokia Lumia 800 handset with airtel as service provider, I activated their GPRS data service (read edge) and I am not able to connect to internet, however earlier I had Vodafone and I never faced such issues with it, I have tried out eve

  • Problem reading weight from my Ohaus Pro scout balance. Model SP2001

    Good evening. I am trying to read a single measurement from a Ohaus Balance (model SP2001). The connection seems to be good, but when I send a print command : P\r, it always reads 0 grams, no matter what I put on the balance. Now the display on the b

  • How to solve this WARNING ITMS-9000

    Hi everybody, I'm getting this error when I submit my app. Anyone now how to solve this ITMS-9000 Warning? I'm quite tired about trying to upload it... Thank you very much!

  • Dataload from R3 hangs -

    Hi Friends, We are loading data (Delta) from R3 The jobs is showing status yellow, infact it shows same status for infinite time. (Normally it takes 5-6 minuts). The job which gets triggered in R3 shows successful completion in SM37. In BW system SM5

  • Registering ipod again

    Despite having registered my ipod sometime ago I keep being asked to re register. I enter all the info but still I get the same message. If I skip registration I cant get a drop down menu of content of my ipod. Any ideas? TIA.