martes, 11 de diciembre de 2012

CLOB to String JAVA

Para poder Transformar una columna CLOB en STRING debemos hacer lo siguiente
String strSQL = "select CLOBCOLUMN from TABLE where id=1"
Statement stmt = Cnx.createStatement();
rs = stmt.executeQuery(strSQL);

while(rs.next()){

  Clob clob = rs.getClob(1);  
  
   if (clob != null) {
     if ((int) clob.length() > 0) {  
        query = clob.getSubString(1, (int) clob.length());  
       
     }  
  }
}

System.out.println(query);

No hay comentarios:

Publicar un comentario