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.

Tags: Database

Similar Questions

  • 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.

  • 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?

  • 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

  • Another key or a function Index Question

    Hello

    I have the following sample tables:
    CREATE THE TABLE1 TABLE:
    (
    NUMBER OF RESOURCE_KEY
    CONSTRAINT TABLE_PK
    KEY ELEMENTARY SCHOOL
    (RESOURCE_KEY)
    )
    /
    CREATE THE TABLE2 TABLE
    (
    RESOURCE2_KEY INTEGER NOT NULL,
    RESOURCE1_KEY INTEGER NOT NULL,
    CONSTRAINT TABLE2_PK
    UNIQUE (RESOURCE2_KEY, RESOURCE1_KEY)
    USING INDEX
    TABLESPACE TRACERT_DATA,
    CONSTRAINT TABLE1_FK1
    FOREIGN KEY (RESOURCE1_KEY)
    REFERENCES TABLE1 (RESOURCE_KEY)
    ON DELETE CASCADE,
    CONSTRAINT TABLE1_FK2
    FOREIGN KEY (RESOURCE2_KEY)
    REFERENCES TABLE1 (RESOURCE_KEY)
    ON DELETE CASCADE
    )
    /
    Insert into TABLE1
    (RESOURCE_KEY)
    Values
    (1) ;
    Insert into TABLE1
    (RESOURCE_KEY)
    Values
    (2) ;
    COMMIT;


    Now comes the tricky part. I want only one of the following inserts to work:
    Insert into TABLE2
    (RESOURCE2_KEY, RESOURCE1_KEY)
    Values
    (1, 2);
    Insert into TABLE2
    (RESOURCE2_KEY, RESOURCE1_KEY)
    Values
    (2: 1);
    COMMIT;


    Any suggestions?

    You can use a single function index based.

    SQL> create table t (x number, y number);
    
    Table created.
    
    SQL> create unique index t_idx on t (greatest(x, y), least(x,y));
    
    Index created.
    
    SQL> insert into t values (2, 1);
    
    1 row created.
    
    SQL> insert into t values (1, 2);
    insert into t values (1, 2)
    *
    ERROR at line 1:
    ORA-00001: unique constraint (TEST.T_IDX) violated
    
    SQL> rollback;
    
    Rollback complete.
    
    SQL> insert into t values (1, 2);
    
    1 row created.
    
    SQL> insert into t values (2, 1);
    insert into t values (2, 1)
    *
    ERROR at line 1:
    ORA-00001: unique constraint (TEST.T_IDX) violated
    
  • function index() in LabWindows 2013 of the compiler

    LabWindows CVI 2013 compiler complains about the use of the variable global 'index', even if 2010 LabWindows is OK with that. The error is an error that is redefined as LabWindows 2013 confused with an old C library string index function.

    Is there a simple solution for that, instead of rename my variable global 'index' in another name?

    Hello nhd973!

    The behavior that you are experiencing is unfortunately a known issue in CVI 2013 (see section incompatibilities):

    http://www.NI.com/product-documentation/51877/en/

    Around that, the simplest method is to rename your global variable.

    However, there is a back door that you can use, which forces the compiler to LabWindows/CVI to ignore the internal controls. You can change the following configuration for these built-ins registry key:

    HKEY_CURRENT_USER\Software\National Instruments\CVI\13.0\Environment\DisableBuiltIns

    By default, this key value is False . Setting its value on True allows the compiler to LabWindows/CVI ignore builtins, so you should not encounter the error again.

    Best regards!

    -Johannes

  • item switch to function index into a text file

    I'm having some difficulties here...

    What I want to do is replace/switch element to an index in an existing text file. When I read the data from the text file I use 'read worksheet file.vi' and read items as strings, so my idea is to use the "write to worksheet file.vi' when I want to update the text file.

    For example, a text file with elements; 1-1-1

    2-2-2

    3 3 3

    An example of what I want to do is to change the place of the first 1 to index (0,0) and the last 3 in index (2.2), which should give me the result in the text file; 3-1-1

    2-2-2

    3 3 1

    Anyone who got advice or ideas? Thank you...

    You should really look at the various functions of table available. And rather than use the function Rotate 1-d array , you can try using the first remove table , then insert into the Array function.

  • function index from functions


    Hello guys,.

    In our select query

    We have as a where condition below

    Select col1 from PEM

    where gnv.getval(start_date,12) > 0

    Here's gnv.getval function.  I'll create index on this feature?

    Pls suggest

    S

    Try this

    select cpd.account_num
      from stage1 cpd
     where cpd.cust_ref = :b3
       and cpd.product_id = :b2
       and nvl(trunc(cpd.startdat), to_date('01/01/4000', 'dd/mm/yyyy')) <= nvl(trunc(:b1), to_date('01/01/4000', 'dd/mm/yyyy'))
       and nvl(trunc(cpd.enddat  ), to_date('01/01/4000', 'dd/mm/yyyy')) >= nvl(trunc(:b1), to_date('01/01/4000', 'dd/mm/yyyy'))
    
  • 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

  • Function index and virtual columns

    I just read the documentation of Oracle on the FBI. In the context of optimization with a function-based index, it is said that "a virtual column is useful for speed of access to data from expressions.". Here is the link Index-Organized Tables and indexes.

    My question is, does Oracle already not create a virtual column when we create a function-based index?

    Concerning

    Charlie

    Hi Charlie
    Yes, the database engine creates a virtual column. But this column is hidden. Reproduced in 11.2.0.3 example:
    SQL> CREATE TABLE t (n NUMBER);SQL> CREATE INDEX i ON t (round(n,0));
    SQL> SELECT column_name, hidden_column, virtual_column  2  FROM user_tab_cols
      3  WHERE table_name = 'T';
    
    COLUMN_NAME                    HIDDEN VIR
    ------------------------------ ------ ---
    N                              NO    NO
    SYS_NC00002$                  YES    YES
    

    HTH

    Chris Antognini

    Troubleshooting performance Oracle, Apress 2008/2014

  • Function index and user_tab_cols

    Why an entry is created in user_tab_cols when we create a function based on a column in a table?

    create table t1(a varchar2(100), b number); 

    select * from user_tab_cols where table_name = 'T1'; -- Two rows coming 

    create index idx1 on t1(upper(a));

    select * from user_tab_cols where table_name = 'T1'; -- Three rows coming

    What is the reason to put an entry in user_tab_cols?

    Martin Preiss wrote:

    If I remember correctly there is also a VIRTUAL_COLUMN attribute in % _TAB_COLS (at least since 11.1).

    Yes, there is, but how it would be useful to determine if the column is the index of based function related? All not stored in the disk column is a virtual column:

    SQL > create table (tbl)
    Number 2,
    3 the number n
    4                  )
    5.

    Table created.

    SQL > create index tbl_idx1 on tbl (abs (n));

    The index is created.

    SQL > alter table tbl
    2. Add n_ceil number generated always as (ceil (n));

    Modified table.

    SQL > alter table tbl change invisible n_ceil;

    Modified table.

    SQL > create index tbl_idx2 on tbl (n_ceil);

    The index is created.

    SQL > select column_id,.
    2 column_name
    virtual_column 3,.
    4 hidden_column
    5 to user_tab_cols
    6 where table_name = "TBL";

    COLUMN_ID COLUMN_NAME HIDDEN VIR
    ---------- ------------------------------ --- ---
    1 ID                             NO  NO
    2 N                              NO  NO
    SYS_NC00003$ YES YES
    N_CEIL YES YES

    SQL >

    As you can see, the two SYS_NC00003$ and N_CEIL are hidden, virtual columns. This part is the same regardless of the version. And in 12 c with the invisible support of solumn, you can't count on the id of null column. That's why (or at least one of the reasons) Oracle introduced another column in the view _TAB_COLS in 12 c - USER_GENERATED:

    SQL > select column_id,.
    2 column_name
    virtual_column 3,.
    hidden_column 4,.
    5 user_generated
    user_tab_cols 6
    7 where table_name = "TBL";

    COLUMN_ID COLUMN_NAME VIR HID USE
    ---------- ------------------------------ --- --- ---
    1 NOT ONLY ID YES
    2 N NO NO YES
    SYS_NC00003$ YES YES NO
    N_CEIL YES YES YES

    SQL >

    Now, we can say column SYS_NC00003$ is related FBI.

    SY.

  • where to find info on the function index according to

    Hello

    With the help of Oracle 11.2, can someone tell me where I can find information about existing indexes to function in my database?

    I want to shrink the unused space on a table, but there is an index FB I have to drop in order to shrink the space.
    Then I need to recreate it after that I have shrink space.
    But how do I know what the index is created to be used for functions?

    I've looked dba_indexes and dba_ind_expressions with no luck.
    I see the index, but I don't see what functions are which are applied for the FB index.


    Thanks in advance.

    958713 wrote:

    select OWNER, INDEX_NAME, INDEX_TYPE, TABLE_OWNER, TABLE_NAME
    from dba_indexes where index_name = 'TQR1_C3';
    
    OWNER      INDEX_NAME INDEX_TYPE                  TABLE_OWNER  TABLE_NAME
    ---------- ---------- --------------------------- ------------ ----------
    TQ         TQR1_C3    FUNCTION-BASED NORMAL       TQ           TQR1
    

    Now, let's view the selection of dba_ind_expressions...

    INDEX_OWNER  INDEX_NAME TABLE_OWNER  TABLE_NAME COLUMN_EXPRESSI COLUMN_POSITION
    ------------ ---------- ------------ ---------- --------------- ---------------
    TQ           TQR1_C3    TQ           TQR1       "C3"                          1
    

    If you have a top-down column in an index the index is reported "based on a normal function", but the expression simply contains the name of the column without mentioning the bit downward. So one possibility is that your index finger is (descendant of c3).

    Concerning
    Jonathan Lewis

  • 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

  • Function Index and Query Rewrite

    Hi members,


    I just stumbled on something that I've never thought of before.

    It has to do with the function according to index and (possibly re - write query)

    Here is my configuration:
    SQL> create table tab1 (
      2    x   varchar2 (1)   default 'N' not null check (x in ('Y', 'N')),
      3    y   varchar2 (100) not null
      4  );
    
    Table created.
    
    SQL> create index tab1ix on tab1 (NULLIF(x,'N'));
    
    Index created.
    
    SQL> insert into tab1 (y)
      2    (select rpad (level,100,'x') from dual connect by level <= 1000);
    
    1000 rows created.
    
    SQL> insert into tab1 (x,y) values ('Y', 'Hello there');
    
    1 row created.
    
    SQL> commit
      2  /
    
    Commit complete.
    
    SQL> exec dbms_stats.gather_table_stats(user, 'tab1', cascade => true)
    
    PL/SQL procedure successfully completed.
    So, I created a small table with a FBI.

    Now, let's use it.
    The first is a query that obviously do not use it.
    Second, one is a query that corresponds to the FBI.
    SQL> explain plan
      2     set statement_id = 'st1'
      3     into plan_table
      4  for
      5  select * from tab1 where x = 'Y';
    
    Explained.
    
    SQL> 
    SQL> select plan_table_output
      2    from table(dbms_xplan.display('PLAN_TABLE', 'st1','TYPICAL'));
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------
    
    ----------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost  |
    ----------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |   501 | 51603 |     5 |
    |   1 |  TABLE ACCESS FULL| TAB1 |   501 | 51603 |     5 |
    ----------------------------------------------------------
    
    
    SQL> explain plan
      2     set statement_id = 'st2'
      3     into plan_table
      4  for
      5  select * from tab1 where NULLIF(x,'N') = 'Y';
    
    Explained.
    
    SQL> 
    SQL> select plan_table_output
      2    from table(dbms_xplan.display('PLAN_TABLE', 'st2','TYPICAL'));
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------
    
    ----------------------------------------------------------------------
    | Id  | Operation                   | Name   | Rows  | Bytes | Cost  |
    ----------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |        |     1 |   103 |     1 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| TAB1   |     1 |   103 |     1 |
    |   2 |   INDEX RANGE SCAN          | TAB1IX |     1 |       |     1 |
    ----------------------------------------------------------------------
    
    SQL> 
    No worries, right?
    Everything works as expected, when my predicate corresponds to the FBI, the index is used.


    But here's what surprises me. It seems that the index expression is rewritten then it is created:
    SQL> select column_expression from user_ind_expressions
      2  where index_name = 'TAB1IX';
    
    COLUMN_EXPRESSION
    --------------------------------------------------------------------------------
    CASE "X" WHEN 'N' THEN NULL ELSE "X" END
    
    SQL>
    Questions are now, is this safe? -Does still work?

    Can I trust the optimizer always did a rewrite such as performed when the index was created?


    This index might live throughout the years and many versions of the optimizer. But the expression stays (I guess)

    This is going into production this weekend, so I wanted to hear,
    ideas / comments?


    Best regards
    Peter
    SQL> select *from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for Linux: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    PS: NULLIF is nothing else than a syntactic sugar for the CASE expression equivalent?
    docs say:
    The NULLIF function is logically equivalent to the following CASE expression:

    CASE WHEN expr1 = END expr1 expr2 THEN NULL ELSE
    edited by: Peter on February 9, 2012 05:32

    Hi Peter

    In the docs for NULLIF, he said

    The NULLIF function is logically equivalent to the following CASE expression:

    CASE WHEN expr1 = expr THEN ELSE NULL expr1 END 2

    http://docs.Oracle.com/CD/B10501_01/server.920/a96540/functions85a.htm
    http://docs.Oracle.com/CD/B19306_01/server.102/b14200/functions102.htm
    http://docs.Oracle.com/CD/E11882_01/server.112/e26088/functions116.htm

    Which would explain the behavior you saw. As you pointed out, it is possible that the transformation of NULLIF expression BOX equivalent is likely to change? It seems unlikely - indeed, it seems to be an alias or a macro for the instruction box unless there is some way technically superior to implement this logic, it seems to be here to stay. Certainly, it has remained unchanged since the 9i.

    Not sure how that helps.

    David

  • Determine the column name involved in functional index

    I write this query for existing indexes for all tables refers to a schema. My problem is when index is functional, column name is not descriptive, it's like SYS_NC00047$,... as long as yet I could not find a way to know the exact column name in the out put of this query. your help is needed...
     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 type of data LONG and LONG default MIS to 80 in SQLPlus, so it will show only the first 80 characters of the expression, unless you SET a higher value for a long TIME.

    Hemant K Collette

Maybe you are looking for

  • HP Envy X 360 15 t mobile Touch: touch screen works not not on computer received YESTERDAY!

    I got my computer yesterday and spent more than five hours with tech support and my touch screen is still not working. Why, he has not been tested before his departure from the warehouse. College starts next week and I don't have a working device!All

  • Avory Labels: Problem with labels

    To easy labels Avory Peal using on my OfficeJet Pro 8600 Plus printer. Problems with them supplies does not correctly the printer. I print about 30 pages at a time and have about 6 or 8 that weakest every time. They never jamb, they just weakest and

  • Predator G9-591-70XR - blue screen AV installation

    My brand new laptop resuses to install no matter WHAT AV which integrates firewall protection. There seem to be a problem before the wifi and blue screens drivber system and I so need to use safe mode to remove the partial installation so that I can

  • Windows 7 OxE0000100 download error

    RE: Windows 7 download error OxE0000100 Try to install Windows 7 (32-bit) via purchase DVD for my Dell Latitude D620 Laptop (XP), I get the above error.  Don't offer _ no _ Custom advanced - only Upgrade Advisor & install now.  Upgrade Advisor made s

  • Unable to sign applications WebWorks

    Hi all I created a Blackberry WebWorks app, which works well in development mode that uses.  However, when I try to add to our BES 12 server I get the following message; An error has occurred. The application is not signed correctly and cannot be add