【发布时间】:2009-11-13 04:45:17
【问题描述】:
我正在 Oracle 10g 上运行 SQL 查询。我有两个表(下面提供的示例数据)。我正在尝试提取一些字段 从表 t2 更新表 t1 中的空列。我遇到以下错误:
ORA 01722:无效数字(指向 REGEXP_SUBSTR)
我知道这是因为我正在尝试使用 REGEXP_SUBSTR* 表达式提取表中的非数字数据(例如“NO code {...}”) 我想知道是否有人可以建议我一些替代实现来帮助我“复制整个字符串”而不是抛出异常。
MERGE
INTO temptab t1
USING directory_list t2
ON (REGEXP_SUBSTR(codelist, '[^.]+', 1) = t2.tcode)
WHEN MATCHED THEN
UPDATE
SET t1.tcode = t2.tcode,
t1.des = t2.des
临时标签 t1
Codelist | T1.tcode | T1.des
1111.1.803.12.X.Z
1000.2.3232.145.M.P
300.12.2982.45.X.Y
NO code {...}
1111.1.803.12.X.Z
directory_list t2
tcode | DES
1000 | powervalue100
300 | powermax300
20 | powermin20
NO code {...} | maxvalue plus
1000 | powervalue100
谢谢,
新手
【问题讨论】: