Hello I am trying to do a query to a oracle database and process the information into a vector. Here id the code: "rs = stmt.executeQuery(comando); con.commit(); Vector vectorHab = new Vector(); while(rs.next()) { Hashtable hashtableHab = new Hashtable(); hashtableHab.put("codigo", rs.getString("codigo")); hashtableHab.put("nome", rs.getString("nome")); vectorHab.addElement(hashtableHab); }" Unfortunately i am getting the error "java.sql.SQLException: ORA-01722: invalid number" I don�t understand why. Can anyone help me.... Thanks Claudia Vaz
taken from here ORA-01722 invalid number Cause: 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. Jamie
Claudia Vaz
Ranch Hand
Joined: Nov 13, 2001
Posts: 44
posted
0
Hi The query is: "select * from HL where codigo>=100000 and codigo<1000000 and codigo not like '99999%'" Thanks Claudia Vaz
Originally posted by Claudia Vaz: Hi The query is: "select * from HL where codigo>=100000 and codigo<1000000 and codigo not like '99999%'" Thanks Claudia Vaz
I don't think you can't compare a String value with and number. codigo is a number and '99999%' can not be properly converted to a number for comparison. What you want to do is convert codigo to character data so you can do the comparison. So try this: "select * from HL where codigo>=100000 and codigo<1000000 and TO_CHAR(codigo) not like '99999%'" Jamie [ March 04, 2002: Message edited by: Jamie Robertson ]