Re: index on calculated column
Posted in 1998
Topics: General Discussion
In article <6m92su$m3i$1@news.xmission.com>,
Joseph Cullipher <joseph@cannonexpress.com> wrote:
>
>I am trying to create an index on a calculated column but keep getting
>a syntax error.
>
>create temp table t1 (started smallint,finished smallint);
>create index t1 on t1(started-finished)>
>I couldn't find anything in the manuals that say I cannot do this but
>it still won't let me. Any suggestions on how I can accomplish this task?
I think you can do it with IUS.
The IUS 9.x Guide to SQL Syntax says (page 1-146)
"For example, the following statement creates a functional index on table
zones using the value returned by the function Area as the key:
CREATE INDEX zone_func_ind ON zones (Area(length,width)) ;"
I think length & width are columns of table zones. Apparently the function
has to be an external C function, so I guess you would have to write one
that computes the difference of its two arguments.
I'm speaking whereof I know not much at all, but this might be a lead for
you.
- Paul (not a spokesman)
I