0 pts.
 Using LIKE with Variable Value not Literal Value….INSTR not optional
I'm trying to build a search type select statement constrained by a users input.....variable(x) which forces the use of like in the selection processing: x := (whatever user enters); I have tried with no luck: Select * from personnel where lastname like '%x%'; Select * from personnel where lastname like "'%" x "%'"; If you know of a way to pass a variable value to a like expression please let me know. Thank you for your time!

Software/Hardware used:
ASKED: July 24, 2006  9:24 AM
UPDATED: July 24, 2006  4:22 PM

Answer Wiki:
BAdams2, I suggest you use bind variables to solve this problem. If that doesn't work, you can always use dynamic SQL. Of course, bind variables are faster. Here is a really informative link. Be sure to check out the follow-up section to the May 21, 2003 entry, as he uses like in the Where clause: http://asktom.oracle.com/pls/ask/f?p=4950:8:9963520253322092830::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:7832114438832 Hope this helps, Charles
Last Wiki Answer Submitted:  July 24, 2006  10:06 am  by  CharlesJC   0 pts.
All Answer Wiki Contributors:  CharlesJC   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

SELECT *
FROM personnel
WHERE lastName LIKE ‘%’ || :x || ‘%’;

Sheldon Linker (sol@linker.com)
Linker Systems, Inc. (www.linkersystems.com)
800-315-1174 (+1-949-552-1904)

 15 pts.