Missing information in SQL*Plus May 19, 2011

By preference I like to work against the databse using SQL*Plus. GUIs are fine and they are much better for developing code than using sql*plus and notepad (or vi or whatever ascii text editor floats your boat). However, for finding things out quickly and also storing what I find (via spool files) then sql*plus is much better. As screens have got larger, I have used a larger – and wider – sql*plus session to show more information at one time.
But I have been having an issue with SQL*Plus not showing some information. I lose information on the right hand side of the screen.

This is on the V10 client on Windows by the way, I’ve seen it on windows XP to Vista.

Look at the below. It is quite a wide output and I have had to increase the standard 80 character linesize from 80 up to 120:

{BTW if you are looking at this in a small browser winder, you might have to click on the screen shot to open it up in it’s own window, to see what I mean – it is quite wide, that is the point of the post – it should just fit in my over-wide blog layout :-)}

Note that for line 8 onwards there is no value for aud_val2. But then, some of the numbers in aud_val1 also look odd. But I’m getting output for some of the lines…

I am in fact getting some of the lines truncated. It just seems to be a bug in the V10 sql*plus client and it might pass you by as the first few lines usually come out “full length”. This truncation only happens if you increase the linesize.

To fix it, you need tell the “windows” sql*plus window how big your output now is. Click on the options and then environment menu items at the top left of the screen:

Change the SQL*Plus environment

Now set the screen buffer width to a bit more than it was, say by one character (and whilst you are at it, why not increasre the buffer length to 2000, the memory required is peanuts on today’s machines). I actually tend to set it to 140 to anticipate some of my more verbose scripts.

Alter the screen buffer width to one or two characters more

And confirm that you are happy to “truncate the buffer” – whoever coded this did not bother to check if you alter the values up or down – you can ignore this message if you are simply increasing the buffers.

Accept the prompt about truncation

Now when I run my sql statement I see the full output {Again, click on the image to see it’s full length to fully see how the problem is now fixed}:

Interesting
I’ve seen similar issues with SQL*PLus on windows but I always use sqlplus.exe. I’ve never really looked into the issues, but the issues seem to start around 150 characters wide. My reaction has just to try and keep things under 150. (these numbers aren’t exact just what I recall)

Sqlplus.exe has several benefits such as being able to take advantage of rlrwap.
Tanel Poder has added an impressive tool kit with script code name completion. I haven’t used it myself but it’s pretty cool to watch him use it.
Cut and paste can be set up on the windows option for sqlplus.exe as well.
It’s easy to change the starting path such that sqlplus.exe starts in the directory that has all my sql scripts.
There are other advantages that I’ve forgotten.

Even without rlwrap, sqlplus.exe has command line history, which sqlplusw.exe lacks. You can copy text with Enter, and paste with right-click. You can configure the font and colours (e.g. to have a different colour for production). Also sqlplusw.exe doesn’t use your font smoothing settings so it remains blocky. I’ve never understood would anyone would use it.

It isn’t perfect (and it is shot dead in 11.2 :-) ) – but it does the job most of the time. As others have pointed out, sqlplus.exe is a little more configurable but when you instal the windows client, the sqplusw is there in front of you and works. Usually :-)

Later versions of Windows, properly built and administered, are as solid and reliable an operating system as any Linux or Unix I have worked on. The problem tends to revolve around the initial build not being good enough, and the administration being less rigorous than you tend to find on Unix servers.

SQL Server 2005 onwards is very much as good as Oracle too, for most people. Again, it tends to be the administration that lets it down. Try hiring a SQL Server admin that can successfully configure and run an 800GiB mirrored environment. You’ll struggle to find one.