DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: FUNCTIONAL INDEX

  1. #1
    Join Date
    Sep 2001
    Posts
    1
    Hi,

    How to view the particular field of a functional index..i have looked into dba_indexes and other views..It's specified as sys_***.... i have created the index for this functrion

    to_char(record_date,'yyyymm')



    Regards,

    sampath

  2. #2
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    SELECT * FROM USER_IND_EXPRESSIONS;

  3. #3
    Join Date
    Jan 2002
    Posts
    5
    We have indexes that have one field which is function based (We have used the DESC keyword) and another which is normal. Does anyone have a script that joins USER_IND_COLUMNS and USER_IND_EXPRESSIONS nicely?

    [Edited by Dramus8 on 01-08-2002 at 10:18 AM]

  4. #4
    Join Date
    Sep 2001
    Location
    NJ, USA
    Posts
    1,287
    select i.table_name,i.index_name,e.column_expression
    from all_ind_columns i, all_ind_expressions e
    where i.index_owner = e.index_owner (+) and
    i.table_name = e.table_name (+) and
    i.index_name = e.index_name (+)
    and
    i.index_owner = '....you_owner...';

  5. #5
    Join Date
    Jan 2002
    Posts
    5
    That doesn't seem to work. The values in ALL_IND_EXPRESSIONS are just the function based columns. The other columns are still in ALL_IND_COLUMNS (along with a system generated field name for the function based column). The problem is...You cannot union the two together because the column_name in all_ind_columns is a varchar and the column_expression in all_ind_expressions is a long.


  6. #6
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598
    To identify the function expression for a given column in an index, there shud be a join on COLUMN_POSITION also. The query thus wud be:

    SELECT
    B.TABLE_NAME, B.INDEX_NAME, SUBSTR(TRIM(B.COLUMN_NAME),1,30),
    A.COLUMN_EXPRESSION
    FROM DBA_IND_EXPRESSIONS A,
    DBA_IND_COLUMNS B
    WHERE A.INDEX_NAME(+) = B.INDEX_NAME
    AND A.INDEX_OWNER(+) = B.INDEX_OWNER
    AND A.TABLE_NAME(+) = B.TABLE_NAME
    AND A.TABLE_OWNER(+) = B.TABLE_OWNER
    AND A.COLUMN_POSITION(+) = B.COLUMN_POSITION;

    Hope this helps.
    Cheers!
    OraKid.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width