amount_sold,
units_sold,
amount_cost)
- SELECT f.time_key,
- sum(f.amount_sold),
- sum(f.units_sold),
- sum(f.amount_cost)
- FROM sales_fact f
- WHERE f.time_key = delta_time_key
- GROUP BY f.time_key;
- -- This query can potentially be very expensive if the trigger
- -- is created on sales_fact without the time_key indexes.
- -- Some care is needed to ensure that this situation does
- -- *not* occur.
+ VALUES (
+ delta_time_key,
+ delta_amount_sold,
+ delta_units_sold,
+ delta_amount_cost
+ );
EXCEPTION
--
-- Catch race condition when two transactions are adding data