Home > Mobile >  java.sql.SQLException: ORA-00920: invalid relational operator (Eclipse)
java.sql.SQLException: ORA-00920: invalid relational operator (Eclipse)

Time:03-02

I am using this sql query in jsp and getting invalid relational operator. I can not figure it out why it is giving me this error.

String gameName = request.getParameter("gameName");
session.setAttribute("gameName",gameName);
Statement st = con.createStatement();
String s2 = "select stock from game where g_name '" gameName "' ";
ResultSet rs1 = st.executeQuery(s2);
String stockDb = "";
rs1.next();
stockDb = rs1.getString(1);
session.setAttribute("stockDb",stockDb);
String stockDb1 = (String)session.getAttribute("stockDb");

CodePudding user response:

It's not that there's an invalid relational operator, it's that you don't have one at all. select stock from game where g_name {name} is like writing a sentence without a verb. It weird. You need an =, LIKE, IN, etc.

  • Related