-1

It's hard to phrase the question in a line of title, so let me rephrase it with an example.

I have a table order with fields order_id, order_date, etc. I want to select all orders that were placed in March, April and May in all years. So records with order_date of 03-MAR-09 and 18-MAY-13, etc. should all be selected.

Is there a date function in Oracle that provides such functionality?

goldfrapp04
  • 2,326
  • 7
  • 34
  • 46
  • http://stackoverflow.com/questions/5979261/plsql-equivalent-to-datepart this might help – Matt Feb 07 '14 at 21:49

2 Answers2

6
select * 
from orders
where extract(month from order_date) in (3,4,5);
4

You can use the Extract() function:

SELECT * FROM myTable WHERE EXTRACT(month FROM order_date) BETWEEN 3 and 5;
Jeffrey Kemp
  • 59,135
  • 14
  • 106
  • 158