Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to create a function index with bind variable?

652398Apr 6 2020 — edited Apr 6 2020

A table, like this,

create table emp(name varchar2(25));

If I use the SQL,

select * from emp where decode(name,:name,1)=1;

How can I create an index for name(with decode function)? Because there is a bind variable in decode not a constant value.

SQL> create index idx_e_01 on emp(decode(name,:name,1));

create index idx_e_01 on emp(decode(name,:name,1))

                         *

ERROR at line 1:

ORA-01027: bind variables not allowed for data definition operations

Thanks.

This post has been answered by Mustafa KALAYCI on Apr 6 2020
Jump to Answer
Comments
Post Details
Added on Apr 6 2020
3 comments
1,062 views