¿Como llamar a una función PL/SQL desde java?

Java, PL/SQL Add comments

 

Aquí les dejo la función para que puedan ocuparla.

   1:  //Recibe como parámetro un String y retorna un String
   2:   
   3:        private String ExtraerFuncion(String usercode) throws SQLException, Exception, Error{
   4:   
   5:              String sql = "", dato="";           
   6:              sql = "{? = call FN_RETURN_FUNCION(?)}";           
   7:              CallableStatement cs = null;
   8:   
   9:              try
  10:              {
  11:                  cs = sessionManager.getConnection().prepareCall(sql);
  12:                  cs.registerOutParameter(1, Types.VARCHAR);
  13:                  cs.setString(2, usercode);
  14:                  cs.execute();
  15:                  dato = cs.getString(1);
  16:              }
  17:              catch (Exception e)
  18:              {
  19:                  e.printStackTrace();
  20:              }
  21:              finally
  22:              {
  23:                   cs.close();
  24:              }
  25:              return dato;
  26:          }

One Response to “¿Como llamar a una función PL/SQL desde java?”

  1. pshycodelic Says:

    Thumb up 0 Thumb down 0

    Muy bueno XD

    Usando Mozilla Firefox Mozilla Firefox 3.0.7 en Windows Windows XP

Deja Un Comentario

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in