Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: indexes and views

Re: indexes and views

From: MBPP <mpacheco_at_directnet.com.br>
Date: 10 Mar 2005 10:25:57 -0800
Message-ID: <1110479157.428896.190200@g14g2000cwa.googlegroups.com>


In Oracle, since version 7.1 I suppose, you can create indexes based on functions or expressions. In your case:

SQL> create index i1 on t1 (to_char(c1)||'.'||to_char(c2));

Index created.

SQL> insert into t1 values (1,2);

1 row created.

SQL> insert into t1 values (3,4);

1 row created.

SQL> insert into t1 values (5,6);

1 row created.

SQL> commit;

Commit complete.

SQL> set autotrace traceonly explain;
SQL> analyze table t1 compute statistics;

Table analyzed.

SQL> select * from v1 where c3 = '1.2';

Execution Plan


   0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=4)    1 0 INDEX (RANGE SCAN) OF 'I1' (NON-UNIQUE) (Cost=1 Card=1 Byt

          es=4) Received on Thu Mar 10 2005 - 12:25:57 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US