我在将表连接到SQL中的子字符串中的结果时遇到问题。
以下是我的发言:
SELECT a.MEASR_COMP_ID
, f.D1_USAGE_ID
, f.SCH_SELECTION_DT
, g.MEASR_COMP_ID
, g.MSRMT_VAL
, i.USAGE_ID
, SUBSTR(dbms_lob.substr(i.USG_DATA_AREA, 4000, 1)
,INSTR(dbms_lob.substr(i.USG_DATA_AREA, 4000, 1)
,'<startReading>') + LENGTH('<startReading>'), 8)
"Start Reading"
, SUBSTR(dbms_lob.substr(i.USG_DATA_AREA, 4000, 1)
, INSTR(dbms_lob.substr(i.USG_DATA_AREA, 4000, 1)
, '<endReading>') + LENGTH('<endReading>'), 8) as "End Reading"
FROM C1_USAGE I
, CISADM.D1_USAGE@CCBMDM f
, CISADM.D1_MSRMT@CCBMDM g
, CISADM.D1_USAGE_PERIOD_SQ@CCBMDM a
WHERE f.USG_EXT_ID = i.USAGE_ID AND
f.D1_USAGE_ID = a.D1_USAGE_ID AND
a.MEASR_COMP_ID = g.MEASR_COMP_ID AND
i.USAGE_ID = '119993413555' AND
SUBSTR(dbms_lob.substr(i.USG_DATA_AREA, 4000, 1)
,INSTR(dbms_lob.substr(i.USG_DATA_AREA, 4000
,1), '<endReading>') + LENGTH('<endReading>'), 8)
as "End Reading" = g.MSRMT.VAL
答案 0 :(得分:1)
应该没问题,除非您应该从条件中删除as "End Reading"
部分,并考虑使用正确的ANSI样式JOIN
语法而不是这种困惑的语法