Procedures com retorno[RESOLVIDO]

3 respostas
MarcioCasteloBranco

Seria possível chamar uma SP retorna parametro desta forma.

PROCEDURE SP_GRV_AUTORIZACAO_DBQ(CD_GESTOR IN NUMBER, SQ_DESBLOQUEIO IN NUMBER, VOTO IN VARCHAR2, NR_ERROR OUT NUMBER, DS_ERROR OUT VARCHAR2)
	IS
		V_ST_DESBLOQUEIO 		NUMBER;
		V_QT_GESTOR 	 		NUMBER;
		V_QT_COMPULSORIO 		NUMBER;
		V_EXISTE_VOTO 	 		VARCHAR2(1);
		V_SQ_DBQ_AUT   	 		NUMBER;
		V_ST_AUT_DBQ 	 		NUMBER;
		V_DT_FINALIZACAO_VOTO 	DATE;
		ST_TEMPO_DESBLOQUEIO 	NUMBER;
	BEGIN
END

sendo chamada n java assim.

public ArrayList<String> sp_Voto_Compulsorio(AutorizacaoCompulsorioTO autorizacaoCompulsorioTO, String voto,  int nr_error, String ds_error) throws DataAccessException {
        Connection connection = this.getConnection();
        CallableStatement statement = null;
       ArrayList<String> nrDsError = new ArrayList<String>();
       
        
        try {
            try {
                statement = connection.prepareCall("{call PC_AUTORIZACAO.SP_GRV_AUTORIZACAO_DBQ (?, ?, ?, ?, ?) }");
                /**
                 * Atributo correpondente à coluna AUT_CD_GESTOR.
                 */
                statement.setInt(1, autorizacaoCompulsorioTO.getCdGestor());
                
                /**
                 * Atributo correpondente à coluna DBQ_SQ_DESBLOQUEIO.
                 */
                statement.setInt(2, autorizacaoCompulsorioTO.getSqDesbloqueio());
                
                /**
                 * Atributo correpondente ao voto.
                 */
                statement.setString(3, voto);
                
                /**
                 * Atributo correpondente ao numero do erro.
                 */
                statement.setInt(4, nr_error);
                
                /**
                 * Atributo correpondente à descrição do erro.
                 */
                statement.setString(5, ds_error);
                
                statement.executeUpdate();
                
                nrDsError.add(String.valueOf(statement.getInt(4)));
                nrDsError.add(statement.getString(5));
 
                
                return nrDsError;
                
                
            } finally {
                if (statement != null) {
                    statement.close();
                   
                }

                if ((connection != null) && (!connection.isClosed())) {
                    connection.close();
                    
                }
            }
        } catch (SQLException e) {
            throw new DataAccessException(e.getCause());

        }

    }

3 Respostas

MarcioCasteloBranco

O SGBD é oracle?

MarcioCasteloBranco

Esta duvida em bem persistente.
Vlw

A

http://www.guj.com.br/posts/list/32129.java

Criado 28 de outubro de 2010
Ultima resposta 28 de out. de 2010
Respostas 3
Participantes 2