select * from folders 
select * from cash_flows
SELECT -- por.description portfolio,
       -- TO_CHAR(cmf.date_due, :default_date_format) value_date,
       ct.description,
       cmf.date_due value_date_date,
       -- ct.description type,
       cur.code ccy,
       -- cmf.cur_uid con_cur,
       -- to_char(cmf.cmf_uid) contract_no,
       -- TO_CHAR(cmf.date_due, :default_date_format) maturity,
       sum(NVL(cmf.amount, 0)) amount
       -- NVL(cmf.base_amount, 0) base_amount
       -- DECODE(cmf.status,
       --       '1', 'Unconfirmed',
       --       '2', 'Confirmed',
       --       'Changed') status,
       -- cmf.cmf_uid cf_uid,
       -- org_cparty.name cparty_name,
       -- null fol_desc, cmf.*
  FROM organisations org,
       organisation_roles or1,
       organisations org_cparty,
       organisation_roles orr_cpy,
       currencies cur,
       contract_types ct,
       portfolios por,
       cash_management_flows cmf
 WHERE 1 = 1
   -- AND :scenario = 0
   -- AND :include_cmf = 'Y'
   -- AND TRUNC(cmf.date_due) BETWEEN :start_date AND :end_date
   AND NOT cmf.status IN ('5', '9')
   AND por.por_uid = cmf.por_uid
   AND ct.ct_uid = cmf.ct_uid
   AND cur.cur_uid = cmf.cur_uid
   AND or1.or_uid = cmf.or_uid_beneficiary
   AND org.org_uid = or1.org_uid
   AND orr_cpy.or_uid = NVL(cmf.or_uid_outflow_to, cmf.or_uid_inflow_from)
   AND org_cparty.org_uid = orr_cpy.org_uid
   AND por.portfolio_type = 'A'
   group by ct.description, cmf.date_due, cur.code, amount order by cmf.date_due
   /* AND por.contingent = DECODE(:contingent_liabilities,
                               'Y', por.contingent,
                               'N') */
  -- AND nvl(:domestic,'N') != 'Y'
 -- AND (:exclude_if_contr_after is NULL OR cmf.date_due <= :exclude_if_contr_after )
 
 CREATE OR REPLACE TYPE day_summary_obj AS OBJECT (
  type varchar2(400),
  category varchar2(400),
  value_date date,
  amount   NUMBER,
  total NUMBER
);
/
SELECT *
FROM (
  SELECT 'D1' AS date_id, TO_CHAR(SYSDATE, 'YYYY-MM-DD') AS value FROM dual
  UNION ALL
  SELECT 'D2', TO_CHAR(SYSDATE + 1, 'YYYY-MM-DD') FROM dual
  UNION ALL
  SELECT 'D3', TO_CHAR(SYSDATE + 2, 'YYYY-MM-DD') FROM dual
)
PIVOT (
  MAX(value) FOR date_id IN ('D1' AS date1, 'D2' AS date2, 'D3' AS date3)
);

SELECT
  MAX(CASE WHEN rn = 1 THEN value_date END) AS date_1,
  MAX(CASE WHEN rn = 2 THEN value_date END) AS date_2,
  MAX(CASE WHEN rn = 3 THEN value_date END) AS date_3
FROM (
  SELECT TO_CHAR(SYSDATE, 'DD.MM.YYYY') AS value_date, 1 AS rn FROM dual
  UNION ALL
  SELECT TO_CHAR(SYSDATE + 1, 'DD.MM.YYYY'), 2 FROM dual
  UNION ALL
  SELECT TO_CHAR(SYSDATE + 2, 'DD.MM.YYYY'), 3 FROM dual
);