Select records for a certain year Oracle
You can use to_date function
http://psoug.org/reference/date_func.html
select *
from sales_table
where tran_date >= to_date('1.1.' || 2013, 'DD.MM.YYYY') and
tran_date < to_date('1.1.' || (2013 + 1), 'DD.MM.YYYY')
solution with explicit comparisons (tran_date >= ... and tran_date < ...)
is able to use index(es) on tran_date
field.
Think on borders: e.g. if tran_date = '31.12.2013 18:24:45.155'
than your code tran_date <='31-DEC-2013'
will miss it
Use the extract function to pull the year from the date:
select * from sales_table
where extract(YEAR from tran_date) = 2013