#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    21
    Rep 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)");
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Amersfoort, The Netherlands
    Posts
    10
    Rep 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

IMN logo majestic logo threadwatch logo seochat tools logo