Click to See Complete Forum and Search --> : Mine looks just like his...


tgrk35
06-04-2009, 03:23 PM
Below I have two sets of sql queries. The top one is mine, the bottom is one that was written by someone else and actually works. If I try the top one, my page errors out. It doesn't give me an error message of course though.

I'm VERY new to this stuff...(JSP)...so any help I could get would be GREATLY appreciated.

Thank you :)

// SQL Query - Pulls from EXITTEST (Eventually switch to EXIT_RESPONSES if necessary).
PreparedStatement briefQuery = oracleConnection.prepareStatement("SELECT COUNT(`sdate`) AS `total`, * FROM KUHR.exittest WHERE `sdate` BETWEEN TO_DATE('" + date_start + "') AND TO_DATE('" + date_end + "') AND DEPARTMENT LIKE '%- " + arsp_num + "% -%'");
ResultSet briefResults = briefQuery.executeQuery();
boolean briefResults_empty = !briefResults.next();
boolean briefResults_full = !briefResults_empty;
Object brief_data;
int briefResults_rows = 0;


// Total Interviews Query
PreparedStatement Statementtotal_recs = oracleConnection.prepareStatement("SELECT COUNT(SDATE) FROM KUHR.exittest WHERE SDATE BETWEEN TO_DATE('" + date_start + "') AND TO_DATE('" + date_end + "') AND DEPARTMENT LIKE '%- " + arsp_num + "% -%'");
ResultSet total_recs = Statementtotal_recs.executeQuery();
boolean total_recs_isEmpty = !total_recs.next();
boolean total_recs_hasData = !total_recs_isEmpty;
Object total_recs_data;
int total_recs_numRows = 0;

chazzy
06-04-2009, 06:20 PM
your query looks nothing like his query. your query looks like someone who's using mysql and his query looks like someone who's using oracle. since you're both using an "oracleConnection" i'm inclined to say that your query is the wrong one.