aspose file tools*
The moose likes Servlets and the fly likes Select date field problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Select date field problem" Watch "Select date field problem" New topic
Author

Select date field problem

Greg Kearney
Greenhorn

Joined: Sep 02, 2000
Posts: 7
Database Oracle 8i.
My program is a calendar JSP where mm/dd 1 through 9 are a single digit.
When I use
<%! public final static String GET_DAYS_EVENTS_QUERY =
"SELECT name, event_id, start_date FROM Events " +
"where to_char(start_date,'yyyy') = ? " +
" and to_char(start_date, 'mm') = ? " +
" and to_char(start_date, 'dd') = ? " +
"ORDER BY event_id"; %>
<%
the database is looking for two digits to be placed in mm/dd. Is there another way to write the select statement where the database will understand a single digit mm/dd, example(3-1-2001)?
Thanks
Brian Nice
Ranch Hand

Joined: Nov 02, 2000
Posts: 195
Try using a function like LPAD:
and to_char(start_date, 'mm') = lpad(month,2,'0')
and to_char(start_date, 'dd') = lpad(day,2,'0')
HTH
Brian
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Select date field problem