Search code examples
javaoracle-databaseresultset

To get the code view in Java with ResultSet.getNString or getString. Does not return the complete string from DBA_VIEWS.text


I'm trying to get the code view (Oracle), in java with resultset. But when I use the getString or getNString function, I only get a chain of 32K characters. The length of the views is greater than 100K characters.

I use the query:

SELECT * FROM DBA_VIEWS

Please help.


Solution

  • I solved with ResultSet.getBinariToString, this function take all characters of dba_views.text. Thank you for all.

    public String getBinaryToString(String columna){
        try {
                java.io.InputStream is = resultados.getBinaryStream(columna);
                int intValueOfChar;
                String targetString = "";
                while ((intValueOfChar = is.read()) != -1) {
                    targetString += (char) intValueOfChar;
                }
                is.close();
                return targetString;
            } catch (SQLException | IOException ex) {
                Logger.getLogger(Base.class.getName()).log(Level.SEVERE, null, ex);
            }
            return null;
    }