1

我有这样的查询:

SELECT * 
FROM uni_customer 
WHERE mobile REGEXP '^(1[3,4,5,8]){1}\\d{9}$'

但是字段中没有这样REGEXP(String)的功能,并且mysql不支持如下语法:

SELECT * 
FROM uni_customer 
WHERE  regexp(mobile,'^(1[3,4,5,8]){1}\\d{9}$')
4

1 回答 1

1

即将推出的 jOOQ 2.5.0 中将很快提供对运营商的官方支持。REGEXP同时,您可以自己扩展 jOOQ,如下所示:

Condition regexp = Factory.condition("{0} REGEXP {1}", 
                                     UNI_CUSTOMER.MOBILE,
                                     val("^(1[3,4,5,8]){1}\\d{9}$"));

或在查询中:

create.select()
      .from(UNI_CUSTOMER)
      .where(condition("{0} REGEXP {1}", 
                       UNI_CUSTOMER.MOBILE, val("^(1[3,4,5,8]){1}\\d{9}$")));
于 2012-08-08T14:59:41.747 回答