Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Catch Error from store procedure. Urgent

843854Oct 5 2004 — edited Oct 6 2004
I'm developing an application in Java that calls a store procedure, but when i try to run and catch the exception than ocurred in the SP, it doesnt.

The exception ocurred when the Function F_VALIDARBUC() detects that there is duplicated bucs and it throws a User Exception(E_BUC).

The application dont catch the exception or oracle doesn't generate the exception.??????????

Whats wrong?

--------
The store procedure code is:

CREATE OR REPLACE PROCEDURE SP_ACTUALIZATABLAS
IS

V_BND_BUC BOOLEAN:= FALSE;

---DECLARACION DE EXCEPTION
E_BUC EXCEPTION;

BEGIN
V_BND_BUC := F_VALIDARBUC();
-- VERIFY IF THERE ISNT MISSING PRODUCTS
SP_VALIDARPRODUCTO;

-- VERIFY IF THERE IS DUPLICATED BUCS
IF (NOT V_BND_BUC) THEN
DELETE FROM GESTION_TMP;
DBMS_OUTPUT.PUT_LINE('ACTUALIZACION DE TABLAS...');
COMMIT;

ELSE
-- DUPLICATED BUCS
DBMS_OUTPUT.PUT_LINE('PROCESO TERMINADO');
RAISE E_BUC;
END IF;

EXCEPTION
WHEN OTHERS THEN ROLLBACK;
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;


-------------

The application code is:

package utilidades;

import Conexion.*;
import java.sql.*;
import java.util.*;

public class CargaOracle {
public CargaOracle() {
}

public int actualizaTablas() throws Exception{
try {
Conexion conexion = new Conexion();
Connection cnApp = conexion.abrirConexion();
CallableStatement cs = cnApp.prepareCall("{call SP_ACTUALIZATABLAS}");

cs.executeUpdate();
SQLWarning err = cs.getWarnings();
System.out.println(err.getMessage());

conexion.cerrarDbs(cnApp);
}
catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 3 2004
Added on Oct 5 2004
1 comment
133 views