Forums Register Login

equalizing a variable in an sql statement

+Pie Number of slices to send: Send
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..
+Pie Number of slices to send: Send
It looks like the column name you listed was not found in the table. I'm not sure, but it may be case sensitive.
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
Tnx Mani Ram.. Your method works.........
I found some pretty shells, some sea glass and this lovely tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 852 times.
Similar Threads
request.parameter
jstl sql action
HFEJB page 435
Need to perform wildcard search
Difference between Statement/Prepared statement?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 12:46:13.