Bom dia a todos.
Estou tentando chamar uma procedure para ser retornada ao meu result set, porém, estou tendo problemas para com os retornos da mesma.
Por exemplo:
public Login logar(String usuario, String senha) throws Exception {
Login funcLogado = new Login();
connection = getConnection();
try {
CallableStatement call = connection.prepareCall("BEGIN PKG_FUNCIONARIO.LOGAR_FUNCIONARIO(?, ?, ?, ?, ?, ?, ?, ?); END;");
call.setString(1, usuario);
call.setString(2, senha);
call.registerOutParameter(3, OracleTypes.NUMBER);
call.registerOutParameter(4, OracleTypes.VARCHAR);
call.registerOutParameter(5, OracleTypes.VARCHAR);
call.registerOutParameter(6, OracleTypes.VARCHAR);
call.registerOutParameter(7, OracleTypes.CHAR);
call.registerOutParameter(8, OracleTypes.CHAR);
res = call.executeQuery();
if(res != null) {
if(res.next()) {
funcLogado.getFuncionario().setId(res.getLong(3));
}
else {
funcLogado = null;
}
}
} finally {
closeConnection();
}
return funcLogado;
}
E ao executar o código, no trecho if(res.next())
o seguinte erro é apresentado: “java.sql.SQLException: Não é possível executar extração em uma instrução PLSQL: next”
O que estou fazendo de errado?
Grato desde já.