Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/02/2010, 06:12
gbaeza1979
 
Fecha de Ingreso: febrero-2010
Mensajes: 1
Antigüedad: 14 años, 3 meses
Puntos: 0
Recuperar array de Oracle

Tengo el siguiente procedimiento en oracle:

Código PHP:
PROCEDURE COMPROBAR_FILTRO_TEST (pResultadoFiltro IN OUT RES_FILTRO)

IS
BEGIN

    presultadofiltro
:=RES_FILTRO();
    
presultadofiltro.extend(5);
    
presultadofiltro(1) := 'N';
    
presultadofiltro(2) := 'S';
    
presultadofiltro(3) := 'S';
    
presultadofiltro(4) := 'S';
    
presultadofiltro(5) := 'N';

EXCEPTION
    WHEN OTHERS THEN
        raise_application_error
(-20009,'OTHERS: '|| sqlcode || sqlerrm);
END; --END PROCEDURE COMPROBAR_FILTRO_TEST 
RES_FILTRO es un tipo declarado por mí de la siguiente manera:
Código PHP:
CREATE OR REPLACE TYPE "RES_FILTRO" AS VARRAY(100OF CHAR
Ahora desde Java, lo intento recuperar de la siguiente manera:

Código PHP:
Connection conn null;
OracleCallableStatement stmt null;

try {

    
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

    
conn DriverManager.getConnection("jdbc:oracle:thin:@<ip>:1521:<instancia>""usuario""password");

    
stmt =(OracleCallableStatement)conn.prepareCall("CALL GBAEZA.COMPROBAR_FILTRO_TEST(?)" );

    
// The name we use below, EMPARRAY, has to match the name of the type defined in SQL
    
stmt.registerOutParameter(1oracle.jdbc.driver.OracleTypes.ARRAY, "RES_FILTRO" );

    
stmt.executeQuery();

    
oracle.sql.ARRAY simpleArray stmt.getARRAY(1);

    
System.out.println("Array is of type " simpleArray.getSQLTypeName());
    
System.out.println("Array element is of type code " +simpleArray.getBaseType());
    
System.out.println("Array is of length " simpleArray.length());

    
String[] values = (String[])simpleArray.getArray();

    
int intContador 0;
    while(
intContador) {
        
String value values[intContador];

        
System.out.println("row " intContador " = " value);
        
intContador++;
    }
}
catch (
SQLException se) {
    
System.out.println(se.toString());
}
catch (
Exception e) {
    
System.out.println(e.toString());
}
finally {
    try {
        
stmt.close();
        
conn.close();
    }
    catch (
SQLException se) {
        
System.out.println(se.toString());
    }


Y esto es lo que obtengo por pantalla:

INICIO SALIDA

Array is of type <esquema>.RES_FILTRO
Array element is of type code 1
Array is of length 5
row 0 = ???
row 1 = ???
row 2 = ???
row 3 = ???
row 4 = ???

FIN SALIDA


¿Alguien sabe por qué obtengo como contenido del array los caracteres ????


Muchas gracias