Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException: ORA-01830: date format picture ends before converting entire input string

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Here is oracle SQL prompt that ran this query fine:


But in my code its throwing the following error:


Her is my code:



Best regards
 
Sudheer Bhat
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you print the value of date variable? The error message clearly says that input string is larger than the provided date format.
You need to make sure that your string should contain exactly 5 characters. For eg 08:00.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The date is 7/30/2011 and has time 14:45
 
Sudheer Bhat
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to strip off the 7/30/2011 part in your date variable and the to_date function should only get 14:45.
 
Farakh khan
Ranch Hand
Posts: 833
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to strip off the 7/30/2011 part in your date variable and the to_date function should only get 14:45.

How?
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use java.lang.String.substring(int, int)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic