In my new / first job we have an Oracle database, in which one of its fields will be loaded on the LOB (Large Objects) data type Has been set. When I run a select statement, I get this problem, which gives me an error as the following.
Error: ORA-22835: Blob for CLAB or ROW conversion to reduce the Burler (Actual: 10228, Max: 4000) The size of the string inside the particle (which are logged) is 10228 more than the maximum capacity of the buffer. Now my boss has asked me to write a Java class which enables us to recover the entire string.
To solve this issue, some guidance is needed about the approach. If we say that I have a Java class ready, then how can I configure it to work with Oracle? Am (server name, user pass)? Is it being kept in the same directory as JDBC and other jar files? . Apart from this, you think the links below are all relevant.
BTW, I was able to follow a temporary solution: database code From select dbms_lob.substr (BLOB_FieldName, 4000, 1) ou [status]; With this query, I was able to get 4000 bytes before the string, but we need the whole string. And then after reading about utl_raw.cast_to_varchar2 I tried the following
select utl_raw.cast_to_varchar2 (dbms_lob.substr (BLOB_fieldName, 19000, 1)) [dbname]; Used to use UTL_vrecost_to_character2 because I have read somewhere that [D2] Datat can hold up to 32K bytes and Wortkar 2 can consider casting [lob] data type, but it does not work. FYI, we are restricted from using PL / SQL Environment is Linux and I have access to the sqldeveloper file which contains JDBC and all other JAR files and can add new files.
In advance thanks
With any up-to-date driver, you Just call ResultSet.getString () to get the CLOB columns and values. No special treatment is required, such as dbms_lob () . 11.x drivers are certainly capable of doing this, are not sure about old 10.x drivers.
If the driver is very old and the upgrade is not an option, you still do not need any special treatment in your SQL statement, just from ResultSet to CLOB code> getCharacterStream ( ) - It also works with 9.x drivers. Something like this:
ResultSet rs = statement.executeQuery ("select from clob_column table_name name ..."); In the reader = rs.getCharacterStream (1); String clavvalue = null; If (!! Rs.wasNull ()) {/} Whatever the reader gives, eg Using Apache Commons IO clobValue = IOUtils.toString (in); } In.close (); With the current driver, you just do:
as a result rs = statement.executeQuery ("select the clock name by the table_name ...") ; String clobValue = rs.getString (1); BTW: Oracle 10 is very old, you really should think about upgrading.
No comments:
Post a Comment