The SQL statement is as follows: Select bu. deptno, count (BU. hiredate) startmonthcount from userinfo Bu, DEPT d Where bu. deptno = D. deptno and BU. hiredate <to_date ('? ', 'Yyyy-mm-dd') group by Bu. deptno
JavaProgramPstmt. setstring (1, firstday );
The following exception occurs:
Java. SQL. sqlexception: Invalid column Index
At oracle. JDBC. Driver. databaseerror. throwsqlexception (databaseerror. Java: 112)
At oracle. JDBC. Driver. databaseerror. throwsqlexception (databaseerror. Java: 146)
At oracle. JDBC. Driver. databaseerror. throwsqlexception (databaseerror. Java: 208)
At oracle. JDBC. Driver. oraclepreparedstatement. setstringinternal (oraclepreparedstatement. Java: 5329)
At oracle. JDBC. Driver. oraclepreparedstatement. setstring (oraclepreparedstatement. Java: 5321)
At org. Apache. tomcat. DBCP. DBCP. delegatingpreparedstatement. setstring (delegatingpreparedstatement. Java: 135)
At org. Apache. tomcat. DBCP. DBCP. delegatingpreparedstatement. setstring (delegatingpreparedstatement. Java: 135)
At com. Neusoft. hr. model. Dao. impl. reportdaoimpl. findstartmonthcount (reportdaoimpl. Java: 258)
At com. Neusoft. hr. model. Service. reportservice. findmonthreportlist (reportservice. Java: 77)
At com. Neusoft. hr. Controller. reportaction. monthreport (reportaction. Java: 98)
At sun. Reflect. nativemethodaccessorimpl. invoke0 (native method)
At sun. Reflect. nativemethodaccessorimpl. Invoke (nativemethodaccessorimpl. Java: 39)
At sun. Reflect. delegatingmethodaccessorimpl. Invoke (delegatingmethodaccessorimpl. Java: 25)
At java. Lang. Reflect. method. Invoke (method. Java: 597)
At org. Apache. Struts. Actions. dispatchaction. dispatchmethod (dispatchaction. Java: 269)
At org.apache.struts.actions.dispatchaction.exe cute (dispatchaction. Java: 170)
At org.apache.struts.chain.commands.servlet.executeaction.exe cute (executeaction. Java: 58)
At org.apache.struts.chain.commands.abstractexecuteaction.exe cute (abstractexecuteaction. Java: 67)
At org.apache.struts.chain.commands.actioncommandbase.exe cute (actioncommandbase. Java: 51)
At org.apache.commons.chain.impl.chainbase.exe cute (chainbase. Java: 190)
At org.apache.commons.chain.generic.lookupcommand.exe cute (lookupcommand. Java: 304)
At org.apache.commons.chain.impl.chainbase.exe cute (chainbase. Java: 190)
At org. Apache. Struts. Chain. composablerequestprocessor. Process (composablerequestprocessor. Java: 283)
At org. Apache. Struts. Action. actionservlet. Process (actionservlet. Java: 1913)
At org. Apache. Struts. Action. actionservlet. dopost (actionservlet. Java: 462)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 637)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 717)
At org. Apache. Catalina. Core. applicationfilterchain. internaldofilter (applicationfilterchain. Java: 290)
At org. Apache. Catalina. Core. applicationfilterchain. dofilter (applicationfilterchain. Java: 206)
At com. Neusoft. hr. utils. encodingfilter. dofilter (encodingfilter. Java: 29)
At org. Apache. Catalina. Core. applicationfilterchain. internaldofilter (applicationfilterchain. Java: 235)
At org. Apache. Catalina. Core. applicationfilterchain. dofilter (applicationfilterchain. Java: 206)
At org. Apache. Catalina. Core. standardwrappervalve. Invoke (standardwrappervalve. Java: 233)
At org. Apache. Catalina. Core. standardcontextvalve. Invoke (standardcontextvalve. Java: 191)
At org. Apache. Catalina. Core. standardhostvalve. Invoke (standardhostvalve. Java: 127)
At org. Apache. Catalina. Valves. errorreportvalve. Invoke (errorreportvalve. Java: 102)
At org. Apache. Catalina. Core. standardenginevalve. Invoke (standardenginevalve. Java: 109)
At org. Apache. Catalina. connector. coyoteadapter. Service (coyoteadapter. Java: 298)
At org. Apache. Coyote. http11.http11aprprocessor. Process (http11aprprocessor. Java: 861)
At org. Apache. Coyote. http11.http11aprprotocol $ http11connectionhandler. Process (http11aprprotocol. Java: 579)
At org.apache.tomcat.util.net. aprendpoint $ worker. Run (aprendpoint. Java: 1584)
At java. Lang. thread. Run (thread. Java: 619)
After careful troubleshooting, it turns out that there was a problem during the date conversion.
Select bu. deptno, count (BU. hiredate) startmonthcount from userinfo Bu, DEPT d Where bu. deptno = D. deptno and BU. hiredate <to_date ('? ', 'Yyyy-mm-dd') group by Bu. deptno
Change to select bu. deptno, count (BU. hiredate) startmonthcount from userinfo Bu, DEPT d Where bu. deptno = D. deptno and BU. hiredate <to_date (?, 'Yyyy-mm-dd') group by Bu. deptno
The problem is solved.