All,
I’m on Toad 12.11.0.37.
I’ve noticed some changes in the formatter:
- it puts AS clauses on a separate line
- in parameter lists, it puts the parameter name and the parameter values on separate lines
I find the new way of formatting undesirable (too many lines, reduces overview of the code)
I have searched for a formatting option to influence this behavior, but failed to locate
any such parameter. What have I missed?
Abe Kornelis
Sample query showing all AS clauses on a separate line:
insert /+append /
into stock_stats.sold_quantities_base_stock
select partno / generate one row for each part - per Country-Group /
, sales_type
, replacement_code
, include_country
, include_group
, main_compno
as compno_wrh
, main_compno
as compno_cus
, group_compno
as compno_group
, redundancy_code
, sum(tot_qty_economical)
as qty_on_stock_economical
, sum(tot_qty_physical)
as qty_on_stock_physical
, round(sum(avg_qty_1yr), 2)
as avg_qty_1yr / Add average stock quantity of all countries to obtain main-country’s total /
, round(sum(avg_qty_2yr), 2)
as avg_qty_2yr / Add average for each country to obtain country-group’s total /
, round(sum(avg_amt_1yr), 2)
as avg_amt_1yr
, round(sum(avg_amt_2yr), 2)
as avg_amt_2yr
, round(sum(avg_qty_1yr_economical), 2)
as avg_qty_on_stock_1yr_econ
, round(sum(avg_qty_1yr_physical), 2)
as avg_qty_on_stock_1yr_phys
, round(sum(avg_qty_2yr_economical), 2)
as avg_qty_on_stock_2yr_econ
, round(sum(avg_qty_2yr_physical), 2)
as avg_qty_on_stock_2yr_phys
, round(sum(avg_amt_1yr_economical), 2)
as avg_amt_on_stock_1yr_econ
, round(sum(avg_amt_1yr_physical), 2)
as avg_amt_on_stock_1yr_phys
, round(sum(avg_amt_2yr_economical), 2)
as avg_amt_on_stock_2yr_econ
, round(sum(avg_amt_2yr_physical), 2)
as avg_amt_on_stock_2yr_phys
, case
when sum(tot_qty_physical) = 0 then round(sum(total_prlcw) / sum(prlcw_count), 5) / default to unweighted average /
else round(sum(total_prlcw) / sum(tot_qty_physical), 5) / Weighted average according to stock level /
end
as avg_prlcw
, sum(tot_amt_economical)
as amt_on_stock_economical
, sum(tot_amt_physical)
as amt_on_stock_physical
, sum(orderlines)
as orderlines
, case
when min(mon_created) is null then p_earliest_period – for missing connections, assume connection has existed since OMS started
else min(mon_created)
end
as mon_created
, current_date
as date_inserted
, null
as date_updated
, mon_code
from (select ssd.partno / here we generate one row for each part - per Legal Entity /
, ssd.sales_type
, ssd.replacement_code
, ssd.include_country
, ssd.include_group
, ssd.main_compno
, ssd.group_compno
, ssd.redundancy_code
, sum(case / calculate total only for data for current month /
when ssd.mon_code = 100 * p_year + p_month then ssd.qty_economical
else 0
end
)
as tot_qty_economical
, sum(case / calculate total only for data for current month /
when ssd.mon_code = 100 * p_year + p_month then ssd.qty_physical
else 0
end
)
as tot_qty_physical
/*********************************************************************************************************************************/
/ TODO: this column could be either removed or kept for backward compatibility; to be superceeded by column AVG_QTY_1YR_PHYSICAL /
, sum(case / Calculate average over last 12 months /
when ssd.mon_code > 100 * (p_year - 1) + p_month then ssd.qty_physical
else null
end
)
/ count(distinct case / Count months with stock /
when ssd.mon_code > 100 * (p_year - 1) + p_month then ssd.mon_code
else null
end
)
as avg_qty_1yr
/**********************************************************************************************************************************/
, sum(case / Calculate average over last 12 months /
when ssd.mon_code > 100 * (p_year - 1) + p_month then ssd.qty_physical
else null
end
)
/ count(distinct case / Count months with stock /
when ssd.mon_code > 100 * (p_year - 1) + p_month then ssd.mon_code
else null
end
)
as avg_qty_1yr_physical
, sum(case / Calculate average over last 12 months /
when ssd.mon_code > 100 * (p_year - 1) + p_month then ssd.qty_economical
else null
end
)
/ count(distinct case / Count months with stock /
when ssd.mon_code > 100 * (p_year - 1) + p_month then ssd.mon_code
else null
end
)
as avg_qty_1yr_economical
/**********************************************************************************************************************************/
/ TODO: this column could be either removed or kept for backward compatibility; to be superceeded by column AVG_QTY_2YR_PHYSICAL /
, sum(ssd.qty_physical) / count(distinct ssd.mon_code)
as avg_qty_2yr / Calculate average over last 24 months /
/***********************************************************************************************************************************/
, sum(ssd.qty_physical) / count(distinct ssd.mon_code)
as avg_qty_2yr_physical
, sum(ssd.qty_economical) / count(distinct ssd.mon_code)
as avg_qty_2yr_economical
/***********************************************************************************************************************************/
/ TODO: this column could be either removed or kept for backward compatibility; to be superceeded by column AVG_QTY_2YR_PHYSICAL /
, sum(case / Calculate average over last 12 months /
when ssd.mon_code > 100 * (p_year - 1) + p_month then ssd.stock_value_physical
else null
end
)
/ count(distinct case / Count months with stock-value /
when ssd.mon_code > 100 * (p_year - 1) + p_month then ssd.mon_code
else null
end
)
as avg_amt_1yr
/**********************************************************************************************************************************/
, sum(case / Calculate average over last 12 months /
when ssd.mon_code > 100 * (p_year - 1) + p_month then ssd.stock_value_physical
else null
end
)
/ count(distinct case / Count months with stock-value /
when ssd.mon_code > 100 * (p_year - 1) + p_month then ssd.mon_code
else null
end
)
as avg_amt_1yr_physical
, sum(case / Calculate average over last 12 months /
when ssd.mon_code > 100 * (p_year - 1) + p_month then ssd.stock_value_economical
else null
end
)
/ count(distinct case / Count months with stock-value /
when ssd.mon_code > 100 * (p_year - 1) + p_month then ssd.mon_code
else null
end
)
as avg_amt_1yr_economical
/**********************************************************************************************************************************/
/ TODO: this column could be either removed or kept for backward compatibility; to be superceeded by column AVG_QTY_2YR_PHYSICAL /
, sum(ssd.stock_value_physical) / count(distinct ssd.mon_code)
as avg_amt_2yr / Calculate average over last 24 months /
/**********************************************************************************************************************************/
, sum(ssd.stock_value_physical) / count(distinct ssd.mon_code)
as avg_amt_2yr_physical
, sum(ssd.stock_value_economical) / count(distinct ssd.mon_code)
as avg_amt_2yr_economical
, sum(case / calculate total only for data for current month /
when ssd.mon_code = 100 * p_year + p_month then ssd.stock_value_economical
else 0
end
)
as tot_amt_economical
, sum(case / calculate total only for data for current month /
when ssd.mon_code = 100 * p_year + p_month then ssd.stock_value_physical
else 0
end
)
as tot_amt_physical
, sum(case / calculate total only for data for current month /
when ssd.mon_code = 100 * p_year + p_month then 1
else 0
end
)
as orderlines
, sum(case / Calculate total prlcw only for current month */
when ssd.mon_code = 100 * p_year + p_month
then
case
when qty_physical = 0 then ext_prlcw
&n