Subject using computed index (only_decimal_chars)
Author tomjanczkadao
Hi
I need to select max from field, but using only decimal chars from this field:

Field1 varchar(20):
'ab2548'
'ag9887'
'cd8745' ...

I wrote SP only_decmial_char which extracts only decimal chars.
My query:
'SELECT MAX((select result from only_decmial_char(Field1)))FROM tab'

It works ok, returns 9887, but it's slow (it reads all records).
I've tried to use computed index:

CREATE INDEX TAB_IDX1 ON TAB COMPUTED BY ((SELECT result FROM only_decmial_char(Field1)));

but query don't use this index.
I've tried even to force use this index: 'PLAN (tab INDEX ("TAB_IDX1"))', but it says: 'index cannot be used in the specified plan'.

Any idea?

Regards, Tomek