Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old September 11th, 2002, 10:24 AM
jhazard jhazard is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 21 jhazard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question date formatting! jsp & sql

Hi

When I try to run this statement I get the following error:
ORA-01861: literal does not match format string

insert into ps_cs_stock_grants_hist values('90980','2002-01-07 00:00:00.0','ONGO','2002-01-07 00:00:00.0','1250','0','USD','96','NQ','2002-01-07 00:00:00.0','N','N','N','622745', '2002-04-17 00:00:00.0','1250','5','BEL_5C_DX ',' ','0','C', '2002 Ongoing Stock PartI ', '2002-04-17 00:00:00.0')

I know my problem is with dates as it works when I replace 2002-01-07 with 07-JUL-2002. Question is how? This is the code that creates the above:

int i = myStmt.executeUpdate("insert into ps_cs_stock_grants_hist values('" + vEmplid + "','" + vGrantdate + "','" + vOptionreason + "','" + vBoarddt + "','" + vOriginalopt + "','" + vOrigacqpc + "','" + vCurrencycd + "','" + vOptionplan + "','" + vOptiontype + "','" + vSpliteligdt + "','" + vRefusegrant + "','" + vStockoptplan + "','" + vCommitment + "','" + vGrantno + "', '" + vRegisterdate + "','" + vRegistershares + "','" + vStockvesting + "','" + vVestingtemplat + "','" + vVpemplid + "','" + vVestcredit + "','" + vGrantstatus + "', '" + vComments + "', sysdate)");

Reply With Quote
  #2  
Old September 16th, 2002, 08:37 AM
EHendriks EHendriks is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: Amersfoort, The Netherlands
Posts: 10 EHendriks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 sec
Reputation Power: 0
Try something like this:

SimpleDateFormat formatter = new SimpleDateFormat("newformat");

Use for the "newformat" the default Oracle Date-Format is this is your database.

Succes,

Erwin

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > date formatting! jsp & sql


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway