| Author |
equalizing a variable in an sql statement
|
Keshini Weerasuriya
Greenhorn
Joined: Jan 08, 2006
Posts: 24
|
|
Hi... I'm trying to equal an ID which is taken as user input in an sql staement as below.. int answer = Integer.parseInt(mainMenu.client); ResultSet rs = st.executeQuery("select * from Client where CliId = answer "); Give the error, java.sql.SQLException: ORA-00904: invalid column name Pls help.. Tnx..
|
 |
Keith Lynn
Ranch Hand
Joined: Feb 07, 2005
Posts: 2341
|
|
|
It looks like the column name you listed was not found in the table. I'm not sure, but it may be case sensitive.
|
 |
Mani Ram
Ranch Hand
Joined: Mar 11, 2002
Posts: 1140
|
|
Also note that you have included the 'answer' variable with in the quotes. So the query that will be executed in the database will be The proper way to build the query is Another way is to use a PreparedStatement
|
Mani
Quaerendo Invenietis
|
 |
Keshini Weerasuriya
Greenhorn
Joined: Jan 08, 2006
Posts: 24
|
|
|
Tnx Mani Ram.. Your method works.........
|
 |
 |
|
|
subject: equalizing a variable in an sql statement
|
|
|