作为提取/加载/转换过程的一部分,您可能应该在 OBIEE 之外计算计数器。
这是在 Oracle 中使用 ROW_NUMBER analytical function 的近似值。
with dataset as (
SELECT 111 AS cust_id,
123456 AS order_id,
'APPROVED' AS status,
1 AS expected_counter
FROM dual
UNION ALL
SELECT 111,123457,'APPROVED',2 FROM dual
UNION ALL
SELECT 111,123458,'APPROVED',3 FROM dual
UNION ALL
SELECT 111,123459,'DECLINED',1 FROM dual
UNION ALL
SELECT 111,123460,'APPROVED',1 FROM dual
UNION ALL
SELECT 111,123461,'APPROVED',2 FROM dual
UNION ALL
SELECT 222,1234562,'APPROVED',1 FROM dual
UNION ALL
SELECT 222,1234563,'APPROVED',2 FROM dual
)
select cust_id,order_id,status,expected_counter,row_number() over (partition by cust_id,status order by order_id asc) as counter from dataset ;
结果是:
cust_id /order_id /status / your_counter / my_counter
111 123456 APPROVED 1 1
111 123457 APPROVED 2 2
111 123458 APPROVED 3 3
111 123460 APPROVED 1 4
111 123461 APPROVED 2 5
111 123459 DECLINED 1 1
222 1234562 APPROVED 1 1
222 1234563 APPROVED 2 2
此示例帮助您找出客户 111 有 5 个已批准的订单和 1 个被拒绝的订单;客户 222 有 2 个已批准的订单。我无法匹配您的确切计数器。希望这会有所帮助