Jul. 24th, 2009

egorius: (Default)

Казалось бы, программисты должны довольно трепетно относиться к типографике, потому что плохо отформатированную программу с кривыми отступами и заглавно-прописными буквами вразнобой совершенно невозможно читать. А вот не тут-то было.

Периодически встречаются такие вот пёрлы:

  select distinct first_value(p1.calendar_period_close_date) over (order by akh1.last_update_date)
     from fa_asset_keywords ak1
     , xx_cfa010_asset_key_history akh1
     , fa_deprn_periods p1
 WHERE 1=1
         and akh1.asset_id = akh.asset_id
         and p1.book_type_code = p_book_type_code
     and akh1.last_update_date>akh.last_update_date
     AND akh1.asset_key_ccid = ak1.code_combination_id
         and akh1.last_update_date between p1.calendar_period_open_date and p1.calendar_period_close_date
         and akh1.last_update_date <= d_end
         and ak1.segment3 = 15

Первое, что я делаю — привожу всё в пристойный вид, причём ручками, без всяких форматтеров:

select distinct first_value(p1.calendar_period_close_date) over (order by akh1.last_update_date)
  from fa_asset_keywords ak1
     , xx_cfa010_asset_key_history akh1
     , fa_deprn_periods p1
 where 1 = 1
   and akh1.asset_id = akh.asset_id
   and p1.book_type_code = p_book_type_code
   and akh1.last_update_date > akh.last_update_date
   and akh1.asset_key_ccid = ak1.code_combination_id
   and akh1.last_update_date between p1.calendar_period_open_date and p1.calendar_period_close_date
   and akh1.last_update_date <= d_end
   and ak1.segment3 = 15

И только потом! Только потом переписываю всё заново.

Profile

egorius: (Default)
egorius

July 2025

M T W T F S S
  12 3 4 5 6
7891011 12 13
1415 1617181920
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 15th, 2025 11:08 am
Powered by Dreamwidth Studios