Disclaimer: most of the coding practices I am about to outline are terrible. Please understand that fixing every place we have this issue is not a trivial effort.
We are supporting an application which unfortunately has functions that return char values or procedures with OUT or IN/OUT parameters that are CHAR. When using ojdbc7.jar on 11g (current production) we observe that any value returned as CHAR datatype is padded to 4000 characters with spaces. After upgrading to 12c we are seeing the values are padded to 32767 characters. We suspect this is related to the MAX_STRING_LENGTH changes in 12c, but we are still set to STANDARD so do not think the driver is aware of this value (assuming there is some logic in the driver that says 11g = 4k buffer, 12c = 32k buffer). We have other code that uses these values via concatenation to build and execute other queries against the database. The maximum length of a string literal is still 4000 characters so now in 12c we get ORA-01704: string literal too long in places that have this combination. Here is an example:
Call function that returns CHAR value "ABC". PL/SQL pads this to 4000, driver pads this to 32k. Set this 32k character string to variable x.
query = "SELECT * FROM table WHERE column = '" + x + "';"
Executing query fails with ORA-01704.
Because 4000 was the max on 11g for both the size of a VARCHAR and for the size of a string literal this issue never manifested. There are so many issues with using CHAR variables beyond this one so the right thing to do is kill them off, but is there a way to make the driver revert to maxing out at 4000 characters? Is there some other stopgap?
I have observed that ojdbc6.jar on 12c does NOT have the issue, but that both ojdbc7.jar and ojdbc8.jar do have the issue.