One of my spare time problems. I have the following which is functional (I hope, it hasn't been tested much) but imho quite ugly:
SELECT my_date + (CASE WHEN my_date BETWEEN next_day( to_date( extract(YEAR FROM my_date)||'0324','YYYYMMDD'), 'Sunday') AND next_day( to_date(extract(YEAR FROM my_date)||'1024','YYYYMMDD'), 'Sunday') THEN 2 ELSE 1 END)/24 FROM my_table;
What it does:
Selects any my_date +1 or +2 hours depending on DST. Some of the ugliness is caused by the need to take into consideration the year of my_date when calculating DST.
Anyone have an idea how to, if possible, make it more elegant? The environment is oracle 9.2. |