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

Home -> Community -> Usenet -> c.d.o.tools -> Re: using SQL TRIM

Re: using SQL TRIM

From: Dusan Marjanov <macko_at_eunet.yu>
Date: Tue, 10 Jul 2001 20:10:27 +0200
Message-ID: <9ifggu$lfh$1@news.eunet.yu>

Constant like :x must be trimmed before it bound to query, isn't? Best regards
DUSAN MARJANOV "Thomas Kyte" <tkyte_at_us.oracle.com> wrote in message news:9id1p90261u_at_drn.newsguy.com...
> In article <3B49C0A6.D13A3F98_at_sympatico.ca>, lance says...
> >
> >if I use SQL command TRIM in a query...will the query still use the
> >indexes?
> >
>
> Depends.
>
> if you have a
>
> table t ( c varchar2(25) )
>
> and and
>
> index t_idx on t(c)
>
> and go:
>
> select * from t where c = trim( :x );
>
> that'll be able to use the index, however,
>
> select * from t where trim(c) = 'some value'
>
> will not be able to use that index but it could use the index:
>
> index t_idx on t(trim(c));
>
>
> see
> http://osi.oracle.com/~tkyte/article1/index.html
> for an overview of function based indexes -- the ability to create an
 index on
> the trim(c).
>
> --
> Thomas Kyte (tkyte@us.oracle.com) http://asktom.oracle.com/
> Expert one on one Oracle, programming techniques and solutions for Oracle.
> http://www.amazon.com/exec/obidos/ASIN/1861004826/
> Opinions are mine and do not necessarily reflect those of Oracle Corp
>
Received on Tue Jul 10 2001 - 13:10:27 CDT

Original text of this message

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