Our application makes heavy use of SQL functions. One such function utilizes a large String variable of this sort:
public static boolean callSQL(Connection conn, String[] s)
throws DatabaseException
{
boolean result = false;
String query = "begin ? := "+qualProc("callSQL")+"(?); end;";
cs.registerOutParameter(1, Types.INTEGER);
**cs.setString(2, GeneralUtils.join(s,","));**
**cs.execute();**
if(cs.getInt(1) > 0)
result = true;
}catch(SQLException se){
se.printStackTrace();
throw new DatabaseException(se.getMessage());
}finally{
if(cs != null)
try{ cs.close(); }catch(SQLException e){}
}
return result;
}
Note: qualProc is the name of our database. For security reasons I'm not using the real name here.
The application itself runs smoothly, but when it attempts to execute the SQL command, we get the following error:
ORA-06532: Subscript outside of limit ORA-06512: at "XXXX.XX", line XXX ORA-06512: at line X
In the package function itself, it uses the String like this:
FUNCTION callSQL(s_tring IN VARCHAR2)
RETURN INTEGER IS
That string can (and has been) longer than the size limit for VarChar2 (32768 Bytes according to this answer https://stackoverflow.com/a/186436/2188082 ).
One option is to separate our Array into manageable chunks and run the SQL Function until it has processed the entire string, but ideally we would like to resolve this with a SQL package change - is there any way to make SQL accept a String that is too long for VarChar2?