We're upgrading from 11gR1 to 11gR2 and have hit upon an anomoly with sqlplus.
The following query yields different results when run in R1 (and any version prior) versus R2:
SELECT rpad('Hello World', 5) Hdr
Notice that the R2 result is actually 15 characters long, as evidenced by the header underlines (changed to '=' for this post). This may seem trivial, but we have hundreds of scripts that look something like the following:
SELECT rpad(A, 20) First,
rpad(B, 30) Second,
rpad(C, 10) Third,
rpad(D, 15) Fourth
I've checked the character sets between the R1 and R2 instances and they're the same:
I installed 126.96.36.199.0 and the problem still exists.
I'm not sure what to try next. Maybe I can write a simple OCI program that prints out what Oracle thinks the column widths coming back from the server are. If the widths are good, that would indicate a bug in sqlplus.
Any other suggestions? A colleague says we should install an 11gR1 client on our development server and use that for running sqlplus, but that's not how we'll be deploying and we'd like to be able to use our existing code as-is in production.
we are experiencing exactly the same problem (in our case 100s of sqlplus scripts utilising substr) - and this is the first mention I've found of the problem, so will be very interested in any solution
I also just ran into this problem, and it is quite annoying.
This might help with the problem: Note 330717.1 Output widths change after upgrade.
It seems that you might have upgraded to the AL32UTF8 character set from an 8-bit character set. Check your NLS_CHARACTERSET setting:
select * from SYS.NLS_DATABASE_PARAMETERS where parameter = 'NLS_CHARACTERSET';
But this doesn't answer the burning question - Is there a way to force column widths to be handled the way they used to be (without needing to explicitly define a format for each column)?