I have below java code:
void insertRatings(String Rname , String uName ,BigDecimal rating , String rDate) throws SQLException, ParseException
{
CallableStatement cs = conn.prepareCall("? = call insertRating(?,?,?,?) ");
cs.registerOutParameter(1, Types.INTEGER);
cs.setString(2, Rname);
cs.setString(3, uName);
cs.setBigDecimal(4, rating);
cs.setDate(5,new Date(new SimpleDateFormat("dd/MM/yyyy").parse(rDate).getTime()));
cs.executeQuery();
System.out.println("Output recived from fucntion :: "+cs.getInt(1));
}
And SQL function is:
create or replace function insertRating(Rname varchar2(100),uName varchar2(100),rating Number,
rDate Date) return Integer is
The SQL function works as expected. However, when I run the java code I get the below error for cs.executeQuery();
Exception in thread "main" java.sql.SQLSyntaxErrorException: ORA-00900: invalid SQL statement
What did I miss?