我试图在两个不同的单词之间提取数字,但是“ substr
”不能与“ instr
”结合使用。至少我没有得到!
例子:
CODTAX TAX_DESCRIPTION
-----------------------
1225 NCM 85444900 IPI 0% ICMS 18% CST 060 IVA 41,00% IVA EXT 51,32%
"IPI" 和 "%ICMS" 之间的提取数是0或 "IVA" 和 "%IVA" 之间的提取数是41.00。
CREATE TABLE TAX
(
CODTAX NUMBER,
TAX_DESCRIPTION VARCHAR2(200 BYTE)
);
INSERT INTO TAX (CODTAX, TAX_DESCRIPTION)
VALUES (1505, 'NCM 29051220 IPI 0% ICMS 18% CST 000 IVA 0% IVA EXT 0%');
INSERT INTO TAX (CODTAX, TAX_DESCRIPTION)
VALUES (1258, 'NCM 85444900 IPI 0% ICMS 18% CST 060 IVA 41,00% IVA EXT 51,32%');
INSERT INTO TAX (CODTAX, TAX_DESCRIPTION)
VALUES (2051, 'NCM 85362000 IPI 10% ICMS 18% CST 060 IVA 43,00% IVA EXT 53,46%');
结果必须是:
CODTAX TAX_DESCRIPTION IPI IVA
----------------------------------------------------------------------------------
1505 NCM 29051220 IPI 0% ICMS 18% CST 000 IVA 0% IVA EXT 0% 0 0
1258 NCM 85444900 IPI 0% ICMS 18% CST 060 IVA 41,00% IVA EXT 51,32% 0 41,00
2051 NCM 85362000 IPI 10% ICMS 18% CST 060 IVA 43,00% IVA EXT 53,46% 10 43,00