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:

is there combination of "like" , "in" in sql?

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

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -