Re: [Q]: Specifying a wildcard search in a SELECT
Posted in 1995
In article <47or8o$lps@atglab10.atglab.bls.com> Ancil Bethelmy for development <cowboy@ranchero.dcsc.bls.com> writes: >Subject: [Q]: Specifying a wildcard search in a SELECT >From: Ancil Bethelmy for development <cowboy@ranchero.dcsc.bls.com> >Date: 7 Nov 1995 23:48:40 GMT >FOLKS: >How do you specify a select so that when it is prepared an "*" is appended to >the search criteria with no intervening whitespace? >DEFINE a CHAR 10 >DEFINE b CHAR 11 >DEFINE query1 CHAR(200) >... ASSUME USER INPUTS PARTIAL OR FULL LENGTH OF a and b LET a = a CLIPPED, "*" LET b = b CLIPPED, "*" >LET query1 = "SELECT field1, field2, field3 FROM table1", >"WHERE field1 = a* AND filed2 = b*" Whoops - use MATCHES, not = >... PREAPRE AND DECLARE CURSOR..... >Basically the value of a and b need to be substituted and the "*" tacked right >onto the end with no intervening whitespace. >I have heard of using "?" as a place holder but I don't know if that will solve >my problem. I also don't quite understand how to implement it in my case. >To sumarize. I will know the full or partial values of a and b and will need to >do a select which passes the value of a concatenated with an "*" and the value >of b concatenated with an "*" also. Any help would be greatly appreciated. >TIA, >-- >Ancil Bethelmy >cowboy@ranchero.dcsc.bls.com