Does db2 4 i support regular expressions?
I want to compare a field to all zeroes. In sqlrpg-ese: select * from table where field = *all'0'
In regular expression terms: select * from table where field = "^0+" (but that didn't work)
This topic has been locked.
4 replies Latest Post - 2013-04-04T21:09:24Z by krmilligan
Pinned topic Select where field is all one character
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-04-04T21:09:24Z at 2013-04-04T21:09:24Z by krmilligan
B.Hauser 1000007U1D218 Posts
PWConner 100000AD5C42 Posts
NickLawrence 060000949J29 PostsACCEPTED ANSWER
Re: Select where field is all one character2013-04-04T17:57:24Z in response to PWConnerOne solution would be to write an external function in an ILE language (such as C or C++), and invoke the function (or table function) from SQL.
The ILE C/C++ runtime library functions include support for regular expressions.
For simple pattern matching, the SQL LIKE predicate is an easier way to go. http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fdb2%2Frbafzch2like.htm
The SQL LOCATE built-in function might also be useful for simple string searches. http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fdb2%2Frbafzscalocate.htm