Results 1 to 15 of 16

Thread: getting first date and last date of previous month in oracle

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    20

    Smile query

    Quote Originally Posted by devanasamy View Post
    hai all

    how can i get all null values of table
    solution:

    Using IS operator we can fetch null values.

    Select * from t1 where c1 is NULL.

  2. #2
    Join Date
    May 2009
    Posts
    1
    You can use TRUNC function to do that.

    select trunc(trunc(sysdate,'MM')-1,'MM') "First Day of Last Month",trunc(sysdate,'MM')-1 "Last Day of Last Month" from dual
    this works great but how can I make it read 30-APR-2009

  3. #3
    Join Date
    May 2009
    Posts
    1
    select to_char(trunc(trunc(sysdate, 'MM') - 1, 'MM'),'DD-MON-YYYY') "First Day of Last Month",
    to_char(trunc(sysdate, 'MM') - 1,'DD-MON-YYYY') "Last Day of Last Month"
    from dual

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •