SELECT
cfh.name template_name,
cf.name forecast_name,
cf.start_period start_period,
cf.start_date start_date,
cf.source_currency src_currency,
gdct.user_conversion_type rate_type,
cf.exchange_date xchange_date,
l3.meaning curr_type_dsp,
cfr.row_number row_number,
l2.meaning aging_type_dsp,
l2.lookup_code aging_type,
cfr.trx_type trx_type,
l1.meaning trx_type_dsp ,
cfe.message_name message_name,
cfe.message_text message_text,
cf.forecast_currency forecast_currency,
NVL(cfe.application_short_name,'CE') application_short_name,
CE_CEFCERR_XMLP_PKG.c_prt_message_nameformula(NVL(cfe.application_short_name,'CE'), cfe.message_name) C_PRT_MESSAGE_NAME
FROM ce_lookups l1,
ce_lookups l2,
ce_lookups l3,
ce_forecast_errors cfe,
ce_forecast_headers cfh,
ce_forecast_rows cfr,
ce_forecasts cf,
gl_daily_conversion_types gdct
WHERE gdct.conversion_type (+) = cf.exchange_rate_type
AND l3.lookup_type = 'FORECAST_CURRENCY_TYPE'
AND l3.lookup_code = cf.currency_type
AND l2.lookup_type = 'FORECAST_AGING_TYPE'
AND l2.lookup_code = cfh.aging_type
AND l1.lookup_type (+) = 'FORECAST_TRX_TYPE'
AND l1.lookup_code (+) = cfr.trx_type
AND cfh.forecast_header_id = cf.forecast_header_id
AND cfr.forecast_row_id (+) = cfe.forecast_row_id
AND cf.forecast_id = cfe.forecast_id
AND cfe.forecast_id = NVL(:P_FORECAST_ID,cfe.forecast_id) |