Revision: 59638
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 21, 2012 03:58 by thescorpion
Initial Code
public static Vector getProducto(String pv_cod_barra) {
Vector producto = new Vector();
Vector listaproducto = new Vector();
CallableStatement cs = null;
String sqlText = "{call package.pr_obtener(?,?,?)}";
Connection conexion = DBConexion.getConnection();
ResultSet rs = null;
boolean found = false;
lv_error=null;
try {
cs = conexion.prepareCall(sqlText);
cs.setString(1, pv_cod_barra);
cs.registerOutParameter(2, OracleTypes.CURSOR);
cs.registerOutParameter(3, Types.VARCHAR);
cs.execute();
if (cs.getString(3) ==null ) {
rs = (ResultSet) cs.getObject(2);
while (rs.next()) {
found = true;
producto = new Vector();
producto.add(rs.getString("columna1"));
producto.add(rs.getString("columna2"));
listaproducto.add(producto);
}
if (!found) {
lv_error="El Código de barra ingresado no existe";
listaproducto =null;
}
}else{
lv_error=cs.getString(3);
listaproducto =null;
}
} catch (SQLException ex) {
Logger.getLogger(Consultas.class.getName()).log(Level.SEVERE, null, ex);
try {
DBConexion.getConnection().close();
} catch (SQLException ex1) {
Logger.getLogger(Consultas.class.getName()).log(Level.SEVERE, null, ex1);
}
listaproducto =null;
}finally{
try {
cs.close();
} catch (SQLException ex) {
Logger.getLogger(Consultas.class.getName()).log(Level.SEVERE, null, ex);
}
}
return listaproducto;
}
Initial URL
Initial Description
Obtener el cursor de oracle y recorrerlo para sacar los datos
Initial Title
Recoger Cursor de Oracle en Java
Initial Tags
java
Initial Language
Java