This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Compare Month & year with Current Month & year in Oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Compare Month & year with Current Month & year in Oracle" Watch "Compare Month & year with Current Month & year in Oracle" New topic
Author

Compare Month & year with Current Month & year in Oracle

Srinivas Katta
Ranch Hand

Joined: Feb 01, 2007
Posts: 76
Hi,

I have a requirement where I need to get a Records those are greater than Current month and Year from Oracle Database

For ex:
We have a Column name requested_start_time which will store data like 01-DEC-12 09.00.00.000000000 AM, We need to have all the records that are scheduled in future from current Date


Any help in this regard is highly appreciated

Thanks
Srinivas
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10174
    
    8

Moving to a more suitable forum...


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

You can use standard relational operators, such as ">", ">=" or "<" with dates.

If you need to round the current date to the start of the month, you could use the trunc function (such as trunc(sysdate, 'MM') -- that would give 2012/11/01 today). However, if you're developing a Java application, you might also perform the date arithmetic in Java, it might be easier (especially with Joda Time library) and more portable.
 
wood burning stoves
 
subject: Compare Month & year with Current Month & year in Oracle
 
Similar Threads
setting default value for a combobox
how to get 3 days less than current date in java
How to extract current month and year's records alone
Record selection based on current month and year
Creating a String from DateTime