The following lines contain the word 'select', 'insert', 'update' or 'delete':
Description: builds the outer select clause
---------------------------------------------------*/
FUNCTION get_rpt_sel_clause(p_view_by_dim IN VARCHAR2,
p_join_tbl IN
poa_dbi_util_pkg.POA_DBI_JOIN_TBL)
RETURN VARCHAR2
IS
l_sel_clause VARCHAR2(32000);
l_view_by_fact_col := isc_dbi_sutil_pkg.get_fact_select_columns (p_join_tbl);
'SELECT
' || isc_dbi_sutil_pkg.get_view_by_select_clause (p_view_by_dim);
' || '(SELECT (rank () over
' || ' (&ORDER_BY_CLAUSE nulls last,
' || l_view_by_fact_col || ')) - 1 rnk,
' || l_view_by_fact_col || ',
' || 'ISC_MEASURE_1,ISC_MEASURE_2,ISC_MEASURE_3,ISC_MEASURE_4,ISC_MEASURE_5,
ISC_MEASURE_6,ISC_MEASURE_7,ISC_MEASURE_8,ISC_MEASURE_9,ISC_MEASURE_10,
ISC_MEASURE_11,ISC_MEASURE_12,ISC_MEASURE_13,ISC_MEASURE_14,ISC_MEASURE_15,
ISC_MEASURE_16,ISC_MEASURE_17
' || 'FROM
' || '(SELECT
' || l_view_by_fact_col || ',
' || l_inner_qty_sel_clause || ' ISC_MEASURE_1,
nvl(c_freight_cost,0) ISC_MEASURE_2,
nvl(p_freight_charge,0) ISC_MEASURE_4,
nvl(c_freight_charge,0) ISC_MEASURE_5,
nvl(c_freight_cost_total,0) ISC_MEASURE_11,
nvl(c_freight_charge_total,0) ISC_MEASURE_13,
' || isc_dbi_sutil_pkg.change_str (
p_new_numerator => 'c_freight_cost',
p_old_numerator => 'p_freight_cost',
p_denominator => 'p_freight_cost',
p_measure_name => 'ISC_MEASURE_3') || ', -- Estimated Fr Cost Change
' || isc_dbi_sutil_pkg.change_str (
p_new_numerator => 'c_freight_charge',
p_old_numerator => 'p_freight_charge',
p_denominator => 'p_freight_charge',
p_measure_name => 'ISC_MEASURE_6') || ', -- Order Fr Charge Change
' || isc_dbi_sutil_pkg.rate_str (
p_numerator => 'c_freight_charge',
p_denominator => 'c_freight_charge_total',
p_rate_type => 'PERCENT',
p_measure_name => 'ISC_MEASURE_7') || ', -- Percent of Total Fr Cost
' || isc_dbi_sutil_pkg.rate_str (
p_numerator => 'p_freight_charge',
p_denominator => 'p_freight_cost',
p_rate_type => 'PERCENT',
p_measure_name => 'ISC_MEASURE_8') || ', -- Prior Recovery Rate
' || isc_dbi_sutil_pkg.rate_str (
p_numerator => 'c_freight_charge',
p_denominator => 'c_freight_cost',
p_rate_type => 'PERCENT',
p_measure_name => 'ISC_MEASURE_9') || ', -- Recovery Rate
' || isc_dbi_sutil_pkg.change_rate_str (
p_new_numerator => 'c_freight_charge',
p_new_denominator => 'c_freight_cost',
p_old_numerator => 'p_freight_charge',
p_old_denominator => 'p_freight_cost',
p_rate_type => 'PERCENT',
p_measure_name => 'ISC_MEASURE_10') || ', -- Recovery Rate Change
' || isc_dbi_sutil_pkg.change_str (
p_new_numerator => 'c_freight_cost_total',
p_old_numerator => 'p_freight_cost_total',
p_denominator => 'p_freight_cost_total',
p_measure_name => 'ISC_MEASURE_12') || ', --Grand Total Estimated Fr Cost Change
' || isc_dbi_sutil_pkg.change_str (
p_new_numerator => 'c_freight_charge_total',
p_old_numerator => 'p_freight_charge_total',
p_denominator => 'p_freight_charge_total',
p_measure_name => 'ISC_MEASURE_14') || ', --Grand Total Fr Charge Change
' || isc_dbi_sutil_pkg.rate_str (
p_numerator => 'c_freight_charge_total',
p_denominator => 'c_freight_charge_total',
p_rate_type => 'PERCENT',
p_measure_name => 'ISC_MEASURE_15') || ', -- Grand Total Percent of Total Fr Cost
' || isc_dbi_sutil_pkg.rate_str (
p_numerator => 'c_freight_charge_total',
p_denominator => 'c_freight_cost_total',
p_rate_type => 'PERCENT',
p_measure_name => 'ISC_MEASURE_16') || ', -- Grand Total Recovery Rate
' || isc_dbi_sutil_pkg.change_rate_str (
p_new_numerator => 'c_freight_charge_total',
p_new_denominator => 'c_freight_cost_total',
p_old_numerator => 'p_freight_charge_total',
p_old_denominator => 'p_freight_cost_total',
p_rate_type => 'PERCENT',
p_measure_name => 'ISC_MEASURE_17'); -- Grand Total Recovery Rate Change