Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL query in Java with variable in where clause

671677Apr 13 2009 — edited Apr 14 2009
Hi,
I'm trying to execute an SQL query from Java, something like this:

String nameVar = "John";
String query = "SELECT * FROM Emp WHERE name = 'nameVar'";

And I want nameVar to be changable within the code. Is any way how to do this? Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 12 2009
Added on Apr 13 2009
6 comments
1,891 views