I'm using Java with an SQL library to work with a spreadsheet I uploaded to an Oracle Database. I calculated student scores that are one standard deviation away from the mean score, and used the "getFloat" method to retrieve the values from the columns as floats. The reason why I did this was to later use those values to compare them in an if statement. However, when I compile, I get a data type mismatch error. The errors occur in the following lines:
float AllScores = selectScore.getFloat("SCORES");
float totalAvg = avgScore.getFloat("SCORE_AVG");
float ScoreStDev = sdev.getFloat("standardDeviation");
I know that I'm getting these errors because I am trying to get float values from a variable that I declared as a String, which holds the "SELECT" statement. My question is, how can I retrieve the float value from the columns to compare it later in my if statement. Some of my code:
String selectScore = "SELECT SCORES FROM STUDENTS";
st.executeQuery(selectScore);
String avgScore = "SELECT Avg(SCORES) AS SCORE_AVG FROM STUDENTS";
rs = st.executeQuery(avgScore);
String sdev = "SELECT STDEV(SCORES) AS standardDeviation FROM STUDENTS";
st.executeQuery(sdev);
int one = 1;
//Loop score column
while(rs.next()){
//Convert values into float values
float AllScores = selectScore.getFloat("SCORES");
float totalAvg = avgScore.getFloat("SCORE_AVG");
float ScoreStDev = sdev.getFloat("standardDeviation");
//Calculate 1 standard deviation away from mean
float theSD = AllScores - (one * ScoreStDev);
}
if(SCORE > ScoreStDev){
//Code here
}
Any help would be appreciated!