Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> SQL statement optimization
Greetings,
I have a table for subscriber information, and sub_number is primary key of VARCHAR(30) type. And I have query as following:
select * from table where sub_number like % || user_input || %;
For example, if there are sub_numbers: '12345678' and '23456789', by input '234', the query will return both sub_numbers.
But this query is extremely slow, and occupy too much CPU usage since it doesn't apply to index.
Is there a way to optimize such query?
Any idea will be greatly appreciated! Thanks in advance!
Evan Received on Thu Nov 06 2003 - 20:40:47 CST
![]() |
![]() |