Jump to content

4 posts in this topic

Posted

Hello,

 

I am trying to generate an automated SQL Report that will always use the current first day of the month. Format: 'YYYY-MM-01'

 

Sadly I dont have the ability to create functions on the database and I do not know how else I can make this work. I saw "SYSDATE()" but I am not familiar with this enough to get it working.

 

Thank you

Share this post


Link to post
Share on other sites

Posted

It's been a loooong time since I touched Oracle, so possibly it's changed since, but this should work if I remember correctly...

 

SELECT TO_CHAR(TRUNC(SYSDATE,'MM'),'YYYY-MON-DD HH24:MI') FROM dual;

Share this post


Link to post
Share on other sites

Posted

one of these should do it...

select
  trunc(current_timestamp, 'mm') 
  ,to_char(trunc(current_timestamp, 'mm'))
from dual

Share this post


Link to post
Share on other sites

Posted

@OP, did you resolve this in the end? Did mine or BGM's posts help?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.