Hi, I am using JDBC to interact with an Oracle DB. I have fields of DateTime type in the DB. I need to write a few queries which require the hour or a particular month for a given date. I know that MySQL has specific functions such as MONTH(Date) which gives the month from a quey and can be used directly in a sql statement. Could some of you guys who have used Oracle tell me the corresponding functions in Oracle. eg. I need a list of the number of customers who came in each hour. I have a DateTime field in the DB. Any help with this query ? Thanks in advance, Anoop
for the hour: select to_char(date_column_name, 'HH12') from table where... **note: 'HH12' = 1-12 or use 'HH24' = 0-24 hours
for the month: select to_char(date_column_name, 'MM') from table where... **note: 'MM'=two digit value or 'MONTH' = name of month padded with blanks to length of nine characters or 'MON' = 3 letter abbreviation of month.
Jamie [This message has been edited by Jamie Robertson (edited November 30, 2001).]
Nair Anoop
Ranch Hand
Joined: May 09, 2001
Posts: 68
posted
0
Jamie, Thank you very much for your help. -Anoop
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.