problem in date conversion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jayantadutta
    New Member
    • Feb 2007
    • 1

    #1

    problem in date conversion

    hi
    i'm facing a problem while transferring date from csv to database.
    my quary as follows

    if (! firstdate.trim( ).equals("")) {

    System.out.prin tln("insertInTo Database startdate "+startdate +" stopdate "+stopdate+"day "+Integer.parse Int(startdate
    .substring(0, startdate.index Of('-')))+ "month"+(Intege r
    .parseInt(start date.substring( startdate.index Of('-') + 1, startdate
    .lastIndexOf('-'))) - 1)+"year"+Integ er.parseInt(sta rtdate
    .substring(star tdate.lastIndex Of('-') + 1,
    startdate.index Of(' '))));
    Calendar cal = Calendar.getIns tance();
    cal.set(Calenda r.DAY_OF_MONTH, Integer.parseIn t(startdate
    .substring(0, startdate.index Of('-'))));
    cal.set(Calenda r.MONTH, Integer
    .parseInt(start date.substring(
    startdate.index Of('-') + 1, startdate
    .lastIndexOf('-'))) - 1);
    cal.set(Calenda r.YEAR, Integer.parseIn t(startdate
    .substring(star tdate.lastIndex Of('-') + 1,
    startdate.index Of(' '))));
    cal.set(Calenda r.HOUR, 0);
    cal.set(Calenda r.MINUTE, 0);
    cal.set(Calenda r.SECOND, 0);
    System.out.prin tln("instartdat e");
    System.out.prin tln("chq"+cal.g etTime().getTim e()+"hi"+cal.ge tTimeInMillis() +"hello");
    //java.sql.Date d = new java.sql.Date(c al.getTimeInMil lis());



    ps.setTimestamp (13, new java.sql.Timest amp ((cal.getTime() .getTime())));




    but its showing that

    ORA-01858: a non-numeric character was found where a numeric was expected

    what should i do?
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by jayantadutta
    hi
    i'm facing a problem while transferring date from csv to database.
    my quary as follows

    if (! firstdate.trim( ).equals("")) {

    System.out.prin tln("insertInTo Database startdate "+startdate +" stopdate "+stopdate+"day "+Integer.parse Int(startdate
    .substring(0, startdate.index Of('-')))+ "month"+(Intege r
    .parseInt(start date.substring( startdate.index Of('-') + 1, startdate
    .lastIndexOf('-'))) - 1)+"year"+Integ er.parseInt(sta rtdate
    .substring(star tdate.lastIndex Of('-') + 1,
    startdate.index Of(' '))));
    Calendar cal = Calendar.getIns tance();
    cal.set(Calenda r.DAY_OF_MONTH, Integer.parseIn t(startdate
    .substring(0, startdate.index Of('-'))));
    cal.set(Calenda r.MONTH, Integer
    .parseInt(start date.substring(
    startdate.index Of('-') + 1, startdate
    .lastIndexOf('-'))) - 1);
    cal.set(Calenda r.YEAR, Integer.parseIn t(startdate
    .substring(star tdate.lastIndex Of('-') + 1,
    startdate.index Of(' '))));
    cal.set(Calenda r.HOUR, 0);
    cal.set(Calenda r.MINUTE, 0);
    cal.set(Calenda r.SECOND, 0);
    System.out.prin tln("instartdat e");
    System.out.prin tln("chq"+cal.g etTime().getTim e()+"hi"+cal.ge tTimeInMillis() +"hello");
    //java.sql.Date d = new java.sql.Date(c al.getTimeInMil lis());



    ps.setTimestamp (13, new java.sql.Timest amp ((cal.getTime() .getTime())));




    but its showing that

    ORA-01858: a non-numeric character was found where a numeric was expected

    what should i do?
    Check your queries and see if you are not supplying a non numeric value where a numeric one is expected.

    Comment

    Working...