Thanks so much Nick!
So I tried sqltrace and did not find the actual query being executed.
I checked PFM functions you mentioned but did not try to put them the way you explained. This helps to get the data at least.
With regards to first query you mentioned, If I run first one, I did not get Operating Costs. It gave me Segment Start, Segment Finish and Rate. Not sure how to interpret that? Could you please help?
Segment Start: 42005
Segment Finish: 42370
Rate: 0.031709792
Second query was able to get me results similar to what I'm looking for.
I'm trying this and still it is not coming close to what I see in UI. Few cents are missing :-(
SELECT
TRUNC (SYSDATE, 'MM') MONTH_START,
ADD_MONTHS(TRUNC (SYSDATE, 'MON'), 1) MONTH_FINISH, p.id,
pfm_sum_fct (p.clob_curve, TRUNC (SYSDATE, 'MM'), ADD_MONTHS(TRUNC (SYSDATE, 'MON'), 1))
AS rate_for_this_month,
pfm_sum_fct (p.clob_curve, NULL, NULL) AS rate_total
FROM pfm_clob_curves p
WHERE p.table_name = 'PFM_PORTFOLIOS'
AND p.attribute = 'TOTAL_COST'
AND
p.id = 5004000