REGEXP帮助 - Oracle Pass Through Query

时间:2016-06-27 12:05:44

标签: regex oracle pass-through

目前在Microsoft Access中工作,将PTQ写入Oracle数据仓库。

其中一个字段是包含字母数字字符串的描述字段。有时所有字符,有时包含9位数字。 我想要做的是,如果有一个9位数字,从该描述字段中选择它并用它创建一个新字段。

SELECT description
     REGEXP_SUBSTR( * here goes the reg exp * ) "REGEXPR_SUBSTR"
FROM myTable

REGEXP_SUBSTR

2 个答案:

答案 0 :(得分:0)

我没有SQLDeveloper或sqlplus来检查它,但让我试试:

public static interface JAXBElementMixin {
    @JsonValue
    Object getValue();
}

ObjectMapper mapper = new ObjectMapper();
JaxbAnnotationIntrospector jaxbAnnotationIntrospector=new JaxbAnnotationIntrospector(mapper.getTypeFactory());
JacksonAnnotationIntrospector jacksonAnnotationIntrospector=new JacksonAnnotationIntrospector();
mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(jaxbAnnotationIntrospector, jacksonAnnotationIntrospector));

mapper.addMixIn(JAXBElement.class, JAXBElementMixin.class);

答案 1 :(得分:0)

select * from
(
SELECT  REGEXP_SUBSTR("desc",'\d{9}') REGEXPR_SUBSTR FROM temp1 
)
where REGEXPR_SUBSTR is not null;

Thil会完美运作。它拒绝空值并且只接受9位数。我写的最后一个答案是匆忙的。 Mi scuzi:)