wood burning stoves 2.0*
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
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: 10268
    
    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: 3610
    
  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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compare Month & year with Current Month & year in Oracle