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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: How to get query to use an index

Re: How to get query to use an index

From: Gints Plivna <gints.plivna_at_gmail.com>
Date: Fri, 14 Apr 2006 18:53:45 +0300
Message-ID: <6e49b6d00604140853g12fc42edh@mail.gmail.com>


2006/4/13, Michael Garfield Sørensen, CeDeT <mgs_at_cedet.dk>:

>

> SQL> REM To the best of my knowledge, the
> SQL> REM modified UNION-ALL-version is
> SQL> REM equivalent to the OR-version if
> SQL> REM (and only if) you rule out NULLs

Third statement below probably is useful even if c1 and/or c2 is null. Additionally to test nulls I'll insert another two rows: insert into mgsx values ('x', null);
insert into mgsx values (null, 'x');
-- original statement ith OR
SQL> select * from mgsx where c1 like 'x%' or c2 like 'x%';

C1 C2
---------- ----------

x          y
x          x
y          x
x          x
x
           x

6 rows selected.

C1 C2
---------- ----------

x          y
x          x
x          x
x
y          x

5 rows selected.

C1 C2
---------- ----------
x y
x

x          x
y          x
x          x
           x

6 rows selected.

Gints

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Apr 14 2006 - 10:53:45 CDT

Original text of this message

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