regexp_replace
获取时间戳的函数,它位于
GREATEST
我在子查询中使用的数据如下所示:
IDDate IDKeys
17-DEC-16 Q=INT^A_NO=123^
03-OCT-18 B_ID=123^
18-OCT-18 C_ID=123^
28-OCT-18 C_ID=123^
SELECT MAX(IDDate) GDATE
FROM HHL h
WHERE regexp_replace(IDKeys, '[^0-9]', '') = '123'
AND LEFT(IDKeys, 1) = 'C'
它返回正确的信息
GDATE
28-OCT-18
但是,当我将其作为子查询合并到外部查询中时,如下所示:
SELECT DISTINCT
c.P_ID,
GREATEST((SELECT MAX(IDDate) GDATE
FROM HHL h
WHERE regexp_replace(IDKeys, '[^0-9]', '') = c.P_ID
AND LEFT(IDKeys, 1) = 'C'), c.CIDDate) GCDate
FROM CICC c
我得到以下错误:
ORA-00600: internal error code, arguments: [kkqcsfixfro:1 -- frooutj], [], [], [], [], [], [], [], [], [], [], []
00600. 00000 - "internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]"
*Cause: This is the generic internal error number for Oracle program
exceptions. It indicates that a process has encountered a low-level,
unexpected condition. The first argument is the internal message
number. This argument and the database version number are critical in
identifying the root cause and the potential impact to your system.
编辑
SUBSTR
和
INSTR
功能而不是
:
SELECT DISTINCT
c.P_ID,
GREATEST((SELECT MAX(IDDate) GDATE
FROM HHL h
WHERE SUBSTR(NVL(SUBSTR(IDKeys, 0, INSTR(IDKeys, '^')-1), IDKeys), INSTR(NVL(SUBSTR(IDKeys, 0, INSTR(IDKeys, '^')-1), IDKeys), '=') + 1) = c.P_ID
AND LEFT(IDKeys, 1) = 'C'), c.CIDDate) GCDate
FROM CICC c