data-warehouse - 在 Informatica 中正确使用 SQL 函数 REGEXP_SUBSTR
问题描述
--特定的 Informatica PowerCenter Qs--
我有这样的传入数据字段,需要从连字符的任一侧提取子字符串并将它们存储在目标表的各个字段中。我从数据库中得到了正确的结果,但在 Informatica 中同样不起作用。在表达式中,我的代码说已成功解析,但没有加载任何内容。
如果有人可以帮助我处理所有 8 条 REGEXP 代码行,那就太好了,因为当我深入字符串时,它似乎有很大不同。
select replace(regexp_substr('ABC-10000-DEF-200-*-*-XYZ-*' ,'[^-]*(-|$)',1,1), '-', '' ) from dual;
select replace(regexp_substr('ABC-10000-DEF-200-*-*-XYZ-*' ,'[^-]*(-|$)',1,2), '-', '' ) from dual;
select replace(regexp_substr('ABC-10000-DEF-200-*-*-XYZ-*' ,'[^-]*(-|$)',1,3), '-', '' ) from dual;
select regexp_substr('ABC-10000-DEF-200-*-*-XYZ-*','[^-]+',1,1) from dual;
select regexp_substr('ABC-10000-DEF-200-*-*-XYZ-*','[^-]+',1,2) from dual;
select regexp_substr('ABC-10000-DEF-200-*-*-XYZ-*','[^-]+',1,3) from dual;
INFA Case 1: When I am using the below, its succeeding for the first occurrence but coming as nulls for the other 7 substring extracts.
REG_EXTRACT(String_Input,'([^-]*),?([^-]*),?([^-]*).*',1) --> Succeeds
REG_EXTRACT(String_Input,'([^-]*),?([^-]*),?([^-]*).*',2) --> Null
REG_EXTRACT(String_Input,'([^-]*),?([^-]*),?([^-]*).*',3) -- Null and so on till 8.
Case 2: When I use the below, I get all Nulls.
REG_EXTRACT('String_Input','[^-]+',1,1) --> Null
REG_EXTRACT('String_Input','[^-]+',1,2) --> Null
REG_EXTRACT('String_Input','[^-]+',1,3) --> Null ```
解决方案
推荐阅读
- python - Python HTTP 总是 301 使用套接字
- php - json_encode 返回充满空值的数组
- html - Django - 如何使您创建的主题公开?学习日志项目
- c - 错误编译,函数指针
- java - 在 Django oscar 中设置 Apache Solr 后端时出错
- maven - 如何使用 mvn 依赖项:获取自定义存储库和登录信息
- r - 在 R 中更改 geom_segment 的颜色
- python - `pip install` 是否将当前目录添加到 PYTHONPATH?
- google-cloud-pubsub - 访问 pubs/sub 时出现 403 错误
- rabbitmq - 互联网断开时的公共交通队列配置