函数符号返回-1,0或1,具体取决于变量testVal的符号,但输出参数未被识别:
static int callableStatement(Connection con, double testVal)
throws SQLException {
CallableStatement cstmt = con.prepareCall("{ ? = Select sign(?)}");
cstmt.registerOutParameter(1, Types.INTEGER);
cstmt.setDouble(2, testVal);
cstmt.executeQuery();
int sign = cstmt.getInt(1);
System.out.println(sign);
return sign;
}
stacktrace给出了SQL错误:
java.sql.SQLException: [Cloudera][JDBC](11420) Error, parameter metadata
not populated.