Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Oracle Query

 
ec hurley
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help? My SQL is giving me an error ORA-00909: invalid number of arguments.

private static final String CUM =
"select SUMMARY_MONTH" +
", SUM(INQ_TOTAL)" +
", SUM(INQ_INVALID)" +
", SUM(RESP_NULL)" +
", SUM(RESP_CACHE)" +
", SUM(RESP_INQ_MGR " +
", SUM(RESP_ACTIVE)" +
", SUM(RESP_INACTIVE)" +
", SUM(RESP_UNDETERMINED)" +
", SUM(RESP_INVALID270)" +
", SUM(RESP_AAA_TOTAL)" +
", SUM(RESP_BADRESP)" +
" from SITE_MONTHLY_SUM" +
" where SUMMARY_MONTH >= TO_DATE('?', 'yyyy/mm/dd')" +
" and SUMMARY_MONTH <= TO_DATE('?', 'yyyy/mm/dd')" +
" GROUP by SUMMARY_MONTH";

public void getCum( java.sql.Date start_date, java.sql.Date end_date)
throws SQLException{
log.info("UserDAOOracleImpl class getCum method");
cumBean cb = (cumBean) sc.getAttribute("cumbean");
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try{
con = getConnection();
log.info("Get Connection successful " + con.toString());
ps = con.prepareStatement(CUM);
ps.setDate(1, start_date);
ps.setDate(2, end_date);
log.info("QUERY = " + CUM);
rs = ps.executeQuery();
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ec hurley:
" where SUMMARY_MONTH >= TO_DATE('?', 'yyyy/mm/dd')" +
" and SUMMARY_MONTH <= TO_DATE('?', 'yyyy/mm/dd')" +




Remove the single quotes for place holder (?)

Shailesh
[ December 10, 2008: Message edited by: Shailesh Chandra ]
 
ec hurley
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Removing the quotes did not solve the problem.
 
ec hurley
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the error. Missing ")" after INQ_MGR.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic