输入:
使用 MATCH_RECOGNIZE 子句编写的查询
select *
from MTR_ACTIONS MATCH_RECOGNIZE (
PARTITION BY METER_CODE
ORDER BY ACTION_DT
MEASURES
FIRST(ENTER.ACTION_DT) AS ENTER_DT,
LAST(EX.ACTION_DT) AS EXIT_DT,
MATCH_NUMBER() AS MN,
CLASSIFIER() AS CLS
-- ALL ROWS PER MATCH
-- ALL ROWS PER MATCH WITH UNMATCHED ROWS
ONE ROW PER MATCH
AFTER MATCH SKIP PAST LAST ROW
PATTERN (ENTER EX+)
DEFINE
ENTER AS (ENTER.ACTION='IN'),
EX AS (EX.ACTION='OUT')
) MR
WHERE METER_CODE ='MTR1'
上述查询的输出:
期望的输出:
无论我在上述查询中的 MEASURES/PATTERN/DEFINE 部分进行什么更改,我都不知道为什么没有填充 EXIT_DT。
如何识别问题?