This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Select date field problem

 
Greg Kearney
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic