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: user defined fct indexes vs 'normal' fct indexes

Re: user defined fct indexes vs 'normal' fct indexes

From: John Russell <netnews4_at_johnrussell.mailshell.com>
Date: Tue, 21 Jan 2003 05:56:46 GMT
Message-ID: <nrnp2vka3pttdh22gcen7tn2enfu3fn5pa@4ax.com>


On 19 Jan 2003 23:00:38 -0800, rene.nyffenegger_at_gmx.ch (Rene Nyffenegger) wrote:
>Hello
>
>I am trying to make Oracle 9.2.0.1.0 on solaris to use my user
>defined function. And I don't have any success. Here's what happens:
>
>create or replace function qq_fnct (v in varchar2)
>return varchar2 deterministic
>as
>begin
> return translate(upper(v),':AEIOU',':');
>end;
>/

Oracle needs to know the maximum length, of the return value for each row that the function processes. You can make an index on a built-in function like UPPER(x) or LOWER(x), where Oracle knows that the return value is the same length as the input value. But a user-written function might return a longer or shorter string than the input parameter. So create your index on
SUBSTR(your_function(your_args),1,max_length) so that the index value is guaranteed never to be longer than the length that you specify.

John Received on Mon Jan 20 2003 - 23:56:46 CST

Original text of this message

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