Posted: Fri Nov 16, 2012 6:38 am Post subject: String Function Contains Issue
Novice
Joined: 07 Oct 2011 Posts: 11
Hi I'm using the CONTAINS function and am experiencing an unexpected result. I have a work around but I'm just wondering if anyone else has experienced this issue.
When I use the CONTAINS function and my search expression contains a blank string, the function will match it to any source expression.
In the code below the contents of the IF statement will always be processed.
Code:
DECLARE TEST_SRCH_EXP CHARACTER;
SET TEST_SRCH_EXP = '';
IF CONTAINS('W,X', TEST_SRCH_EXP) THEN
//Perform Task
END IF;
This is not the result I want, can anyone tell me why this occurs?
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
It may not be the result you want, but it is the way the function is designed. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum