sql In clause with wildcards (DB2) -
is there anyway use wildcards in clause similar "in", this
select * table columnx xxxxxxx ('%a%','%b%')?
i know can do:
select * table (columnx '%a%' or columnx '%b%')
but i'm looking alternative make querystring shorter.
btw: i'm not able register custom functions, nor temp tables, should native db2 function.
i found similar answer oracle , sqlserver:
there's no native regular expression support in "puresql" db2, can either create own in:
http://www.ibm.com/developerworks/data/library/techarticle/0301stolze/0301stolze.html
or use purexml in: http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.xml.doc/doc/xqrfnmat.html
example:
where xmlcast(xmlquery('fn:matches(\$text,''^[a-za-z 0-9]*$'')') integer) = 0
yet variant may shorter:
select t.* table t join ( values '%a%', '%b%' ) u (columnx) on t.columnx u.columnx
Comments
Post a Comment