no message

This commit is contained in:
AzureAD\SylvainDUVERNAY
2026-02-02 15:52:52 +01:00
parent 7f99b78c8a
commit 0fa522ece6
6 changed files with 134 additions and 5 deletions

30
vw_bi_dim_trade.sql Normal file
View File

@@ -0,0 +1,30 @@
-- Dimension Trade View
-- This view consolidates trade information from physical purchase and sale contracts and derivatives
CREATE OR REPLACE VIEW public.vw_bi_dim_trade AS
SELECT
"intPurchaseLineId" AS "intTradeId",
'Physical' AS "Trade Category",
'Purchase' AS "Trade Type",
"strReference" AS "Trade Ref",
"dtmContractDate" AS "Trade Date",
"strCounterparty" AS "Counterparty"
FROM public.vw_utility_dim_physical_purchase_contract
WHERE 1=1
AND "intPurchaseLineId" > 0
UNION ALL
SELECT
"intSaleLineId" AS "intTradeId",
'Physical' AS "Trade Category",
'Sale' AS "Trade Type",
"strReference" AS "Trade Ref",
"dtmContractDate" AS "Trade Date",
"strCounterparty" AS "Counterparty"
FROM public.vw_utility_dim_physical_sale_contract
WHERE 1=1
AND "intSaleLineId" > 0;
-- UNION ALL
-- Derivative contracts can be added here in the future
ALTER TABLE public.vw_bi_dim_trade
OWNER TO postgres;