?
Solved

How do I check for first and last day of month in Oracle

Posted on 2014-11-26
2
Medium Priority
?
262 Views
Last Modified: 2014-11-27
Experts,

Does anyone know the syntax for testing for the first and last day of month in Oracle?
0
Comment
Question by:morinia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Assisted Solution

by:johnsone
johnsone earned 1000 total points
ID: 40467671
First day of the current month at midnight:

trunc(sysdate, 'MM')

Last day of the current month current time of day:

last_day(sysdate)

Last day of the current month midnight:

last_day(trunc(sysdate))

Last day of the current month at end of day:

last_day(trunc(sysdate)) + (84399/86400)
0
 
LVL 22

Accepted Solution

by:
Helena Marková earned 1000 total points
ID: 40468481
As an addition to the complex johnsone's answer you can read about datetime format elements:
https://docs.oracle.com/cd/E11882_01/server.112/e41084/sql_elements004.htm#CDEHIFJA
0

Featured Post

How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question