Here are examples of Oracle SQL queries to get the current month data.
Oracle SQL - Get Current Month Data Examples
The following example will compare the order date with SYSDATE's month and year using the
select * from sales_orders where to_char(order_date, 'mm') = to_char(sysdate, 'mm') and to_char(order_date, 'yyyy') = to_char(sysdate, 'yyyy') order by order_date;
You can also get the current month data using the below SQL query:
select * from sales_orders where trunc(order_date) >= trunc(sysdate, 'mm') and trunc(order_date) <= last_day(sysdate) order by order_date;
In the above example, the
trunc(sysdate, 'mm') condition will get the first day of the month and the
last_day(sysdate) will obviously get the last day of the month.
Leave a comment