Click here to Skip to main content
15,897,360 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have below query :
i have to select All the records wheixh start from user input
Like User Input : 123

SELECT TBLUSERACTIVITIES.UID_R, TBLUSERACTIVITIES.ACTION, TO_CHAR(TBLUSERACTIVITIES.DATE_R,'MM/DD/YYYY HH24:MI') DATE_R
FROM EAITEMP.TBLUSERACTIVITIES TBLUSERACTIVITIES
WHERE (TBLUSERACTIVITIES.EVENTID1 LIKE '123%') or (TBLUSERACTIVITIES.EVENTID2 LIKE '123%')

To return the records, it taking much of time. So i need to reduce the time by replacing like operator with other logic.

Thanks in Advance
Posted

Here some suggestions, for Oracle: "Is substr or LIKE faster in Oracle?" at Stack Overflow[^].
 
Share this answer
 
Comments
Jörgen Andersson 31-Jan-14 7:25am    
A function based index of this kind would only work with a specific length of the text. You would need a different index for every length of the search string.
This is because it will make a full table scan for every query.
You need a text index[^]
 
Share this answer
 
Rather than writing multiple LIKE in sql staements you can use N'123%'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900