public static String convertToClob ( final String varchar ) { int startIndex = 0 ; int endIndex = Math . min ( startIndex + 4000 , varchar . length ( ) ) ; final StringBuilder clobs = new StringBuilder ( "TO_CLOB('" ) . append ( varchar . substring ( startIndex , endIndex ) ) . append ( "')" ) ; while ( endIndex < varchar . length ( ) ) { startIndex = endIndex ; endIndex = Math . min ( startIndex + 4000 , varchar . length ( ) ) ; clobs . append ( " || TO_CLOB('" ) . append ( varchar . substring ( startIndex , endIndex ) ) . append ( "')" ) ; } return clobs . toString ( ) ; }
Generates the SQL to convert the given string to a CLOB .