Re: Weirdness with escaped characters in WHERE clauses....
Posted in 1994
->From: reetz@ncar.ucar.edu (Mike Reetz)
->Subject: Weirdness with escaped characters in WHERE clauses....
->Date: 15 Apr 1994 17:17:02 GMT
->Reply-To: reetz@ncar.ucar.edu
->Organization: UCAR - University Corporation for Atmospheric Research
->
->Has anyone seen this before:
->
->ISQL
->
->SELECT * FROM tab1 WHERE ch1 MATCHES "*\\?*"
->
->works fine...returning all rows where column ch1 contains
->a question mark (?).
->
->4GL
->
->DECLARE c_fa CURSOR FOR
-> SELECT * FROM tab1 WHERE ch1 MATCHES '*\\?*'
->
->
->returns all the rows in table tab1.
->
->But, if I use
->
->DECLARE c_fa CURSOR FOR
-> SELECT * FROM tab1 WHERE ch1 MATCHES '*z?*' ESCAPE "z"
->
->works fine...returninf the same rows as the ISQL statement.
->
->What gives?!? Is this a bug?
->
->--
->-------------------------------------------------------------------------------
->Mike Reetz reetz@ncar.ucar.edu 3450 Mitchell Lane
->UNIX(tm) Operations Manager (303)497-8881(V) 497-8501(Fax) Building 1
->UCAR - University Corporation For Atmospheric Research Boulder, CO 80301
->
In 4GL you need something like:
DECLARE c_fa CURSOR FOR
SELECT * FROM tab1 WHERE ch1 MATCHES '*\\\\?*'You might even need to say: MATCHES "*\\\\\\?*"
(I always need to fiddle with the number of \\\\ to get it to work right.)
Remember that this code goes thru the C compiler, etc., so you need to ESCAPE
the ESCAPE character. (Hmm, I'm not sure what happens when using RDS in this
case.)
Regards,
Alan ___________________________
______________________| R. Alan Popiel |__________________________
\\ Internet: | Martin Marietta, SLS | /
\\ alan@den.mmc.com | P.O. Box 179, M/S 3810 | Std disclaimers apply. /
)Voice: | Denver, CO 80201-0179 USA | (
/ 303-977-9998 |___________________________| (But you knew that!) \\
/________________________) (____________________________\\