sequence id generation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mallz
    New Member
    • Mar 2007
    • 52

    sequence id generation

    hi, im incrementing my id by using sequence in oracle......... but i dont know what to specify in my insert statement in my jsp page..........

    while i tried in oracle it worked........i said :
    insert into table values(id.nextv al,'aaa');

    but, in my jsp page im getting an error saying : invalid number.......
    please help me out with this
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by mallz
    hi, im incrementing my id by using sequence in oracle......... but i dont know what to specify in my insert statement in my jsp page..........

    while i tried in oracle it worked........i said :
    insert into table values(id.nextv al,'aaa');

    but, in my jsp page im getting an error saying : invalid number.......
    please help me out with this
    Please post the code in the jsp that is giving the error and the full error message that you are getting.

    Comment

    • mallz
      New Member
      • Mar 2007
      • 52

      #3
      Originally posted by r035198x
      Please post the code in the jsp that is giving the error and the full error message that you are getting.
      hi,
      this is the error that im getting, the error does not appear in my browser window....but in my tomcat server logs....

      java.sql.SQLExc eption: [Microsoft][ODBC driver for Oracle][Oracle]ORA-01722: invalid number

      this is my code:

      String s1=request.getP arameter("m1");
      String s2=request.getP arameter("m2");
      String s3=request.getP arameter("m3");

      Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
      con=DriverManag er.getConnectio n("jdbc:odbc:ap s","scott","tig er");
      st=con.createSt atement();

      String query1="insert into MOM
      values('meeting id.nextval','"+ s1+"','"+s2+"', '"+s3+"');


      note: i have created a sequence for meetingid in my database....... .

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by mallz
        hi,
        this is the error that im getting, the error does not appear in my browser window....but in my tomcat server logs....

        java.sql.SQLExc eption: [Microsoft][ODBC driver for Oracle][Oracle]ORA-01722: invalid number

        this is my code:

        String s1=request.getP arameter("m1");
        String s2=request.getP arameter("m2");
        String s3=request.getP arameter("m3");

        Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
        con=DriverManag er.getConnectio n("jdbc:odbc:ap s","scott","tig er");
        st=con.createSt atement();

        String query1="insert into MOM
        values('meeting id.nextval','"+ s1+"','"+s2+"', '"+s3+"');


        note: i have created a sequence for meetingid in my database....... .
        Here is what I got when I checked on google.

        ORA-01722:invalid numberCause:The attempted conversion of a character string to a number failed because the character string was not a valid numeric literal. Only numeric fields or character fields containing numeric data may be used in arithmetic functions or expressions. Only numeric fields may be added to or subtracted from dates.Action:Check the character strings in the function or expression. Check that they contain only numbers, a sign, a decimal point, and the character "E" or "e" and retry the operation.

        Comment

        • hirak1984
          Contributor
          • Jan 2007
          • 316

          #5
          where is your meetingid?

          please post its type and check if the type matches with the type in table in oracle.

          Originally posted by mallz
          hi,
          this is the error that im getting, the error does not appear in my browser window....but in my tomcat server logs....

          java.sql.SQLExc eption: [Microsoft][ODBC driver for Oracle][Oracle]ORA-01722: invalid number

          this is my code:

          String s1=request.getP arameter("m1");
          String s2=request.getP arameter("m2");
          String s3=request.getP arameter("m3");

          Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") ;
          con=DriverManag er.getConnectio n("jdbc:odbc:ap s","scott","tig er");
          st=con.createSt atement();

          String query1="insert into MOM
          values('meeting id.nextval','"+ s1+"','"+s2+"', '"+s3+"');


          note: i have created a sequence for meetingid in my database....... .

          Comment

          Working...