Using:
select name, id
from "TEST"
where id :2
AND name :1
order by id desc
I am getting ORA: 00904 "TEST"."NAME": invalid identifier
error but the wierd part is that I have checked my test table and it does not have NAME field but it has name field, I have also checked all the references which is made from that table and all other constraints but still it gives me same error. I do not know why, is there a way where I can check all the columns of the database for NAME column name or any other debuggind approach recommended would be highly welcomed.
DESC TEST; Name Null Type
id NOT NULL NUMBER(11)
name VARCHAR2(29)
2 rows selected
EDIT
DESC TEST
Name Null Type
------------------------------ -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ID NOT NULL NUMBER(11)
NAME VARCHAR2(29)
2 rows selected
Java Code
public String searchExecute(HttpServletRequest req, javax.servlet.ServletContext ctx, String nextPage){
// ESCA-JAVA0266:
System.out.println("This is Awesome");
// ESCA-JAVA0266:
System.out.println("id:"+req.getParameter("s_1985"));
// ESCA-JAVA0266:
System.out.println("name:"+req.getParameter("s_1984"));
boolean bDisplayAll = StringUtils.stringToBoolean(req.getParameter("display_all"));
if(bDisplayAll)
// ESCA-JAVA0034:
req.setAttribute("c_display_all", "Y");
req.setAttribute("c_search_submitted", "Y");
return nextPage;
}
JSP Code
<%@ page import="att.leadx.dbutils.AppUtils" %>
<%@ page import="java.util.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
1">
</head>
<link rel=stylesheet type=text/css href="leadx.css">
<body bgcolor="#FFFFFF"><BR>
<form NAME="forma" ACTION="dispatcher" METHOD="post">
<INPUT TYPE="hidden" name="action" value="">
<input type=hidden name="c_master" value="TEST_SEARCH">
<%
request.setAttribute("c_form", "TEST_SEARCH");
request.setAttribute("c_top_title","PROFILE > TEST_SEARCH");
request.setAttribute("c_top_link_image","images/setup_sm.gif");
request.setAttribute("c_top_link_action","user.search.setup");
request.setAttribute("c_top_link_app_func","search_setup");
request.setAttribute("c_top_link_alt_display","Setup search criteria");
%>
<jsp:include page="j_custom_search.jsp" flush="true" />
<table width="94%" border="0" cellspacing="1" cellpadding="3" align=center>
<tr>
<td colspan=4 align=center>
<INPUT TYPE="submit" value="Search" class=prismsbutton onclick="document.forma.action.value ='cep.project.search.execute'">
</td>
<td colspan=4 align=center>
<INPUT TYPE="button" value="Cancel" class=prismsbutton onclick="window.history.back()">
</td>
</tr>
</table>
</form>
<form NAME="formd" ACTION="dispatcher" METHOD="post">
<input type="hidden" name="c_jsp" value="j_test_dynamic_search.jsp">
<%
request.setAttribute("c_master", "TEST_SEARCH");
request.setAttribute("c_html_form","formd");
request.setAttribute("c_list_id","1984");
request.setAttribute("c_search_form","TEST_SEARCH");
Object args[] = att.utils.DataStore.arg(att.leadx.dbutils.AppUtils.getLoggedInUser(request), att.utils.DataStore.TYPE_NUMERIC);
request.setAttribute("c_args", args);
if (att.utils.StringUtils.stringToBoolean((String)request.getAttribute("c_search_submitted"))){
%>
<jsp:include page="j_master_detail_dlist.jsp" flush="true" />
<%
}
%>
</form>
<%!
private void o(String s){
if (att.leadx.dbutils.AppUtils.inDebug())
System.out.println("[J_USER_SEARCH.JSP] " + s);
}
%>
SQL Statement
select name, id from TEST where name = :1 AND id = :2 order by id desc
Error Message
Aug 16, 2010 5:22:21 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.sql.SQLException: ORA-00936: missing expression
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1451)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:651)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2110)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2324)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:627)
at att.utils.DataStore.retrieve(DataStore.java:724)
at org.apache.jsp.j_005fmaster_005fdetail_005fdlist_jsp._jspService(j_005fmaster_005fdetail_005fdlist_jsp.java:566)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:659)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:565)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:493)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:965)
at org.apache.jsp.j_005ftest_005fdynamic_005fsearch_jsp._jspService(j_005ftest_005fdynamic_005fsearch_jsp.java:102)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:659)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:457)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:311)
at att.leadx.nav.Dispatcher.service(Dispatcher.java:113)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
Thanks
SELECT *
FROM ALL_TAB_COLS
WHERE UPPER(COLUMN_NAME) = 'NAME';
will show you all columns called NAME
EDIT:
Based on your comment, aren't you missing the operators in your WHERE clause? ie =
select name, id
from "TEST"
where id :2 -- Surely you mean: id = :2
AND name :1 -- Surely you mean: name = :2
order by id desc
EDIT 2:
Based on the SQL*Plus output, it looks like you've created the table with lower-case column names. Whilst this is possible and valid it's usually just hard work. I'd recreate the columns with upper case names. (as Alex said)
EDIT 3:
I think...
SELECT "id", "name"
FROM TEST
WHERE "id" = :1
AND "name" = :2
ORDER BY "id" desc;
should work