A lot of times people will ask Quest tech support or via our Yahoo discussion groups how to make the editor run SQL commands and do stuff more like SQL*Plus or how to better control the output look and feel (i.e. behavior). Along those lines and another very popular question is where one can set an option in Toad for the editor to do something specific (e.g. turn off feedback, etc) – because they have already done an online help search and didn’t find anything. The good news is that both are already in there and actually handled the same way Oracle implements this feature, which Toad fully supports – but you do have to know how Oracle does it to effectively utilize Toad’s capability. Thus here’s some additional info to help solve such questions.
Look at my query below – pretty simple, but the “execute as script” (F5) output is pretty ugly. Let’s say that I want to space the columns more, set my line size, trim trailing spaces, convert tabs to spaces, and turn off the feedback (i.e. the “rows selected” message). Looking in the Toad options – one will not find these. But it is in there – so please read on.
So how would one normally fix this in SQL*Plus? The answer is by simply adding a bunch of SQL*Plus SET commands to the script – as shown here.
Now see how much easier we can read the output. Yes – we may need to scroll left and right, but we can quite easily now read the results. But I’m as lazy as they come. I don’t want to have to type those five commands every time I work on a script – but remember, there weren’t any obvious Toad options to control this. Hmmmmm – what to do, what to do …..
We do exactly as we would have in SQL*Plus, we create a LOGIN.SQL script and place the SQL*Plus SET commands in there – thus we are making use of the SQL*Plus environment “login scripting” to solve this problem. Now search again on Toad’s online help for “login” – and you’ll arrive at Toad’s login scripting options shown here.
If I simply press the edit button for login.sql script, enter those five SQL*Plus SET commands, and then check the box to execute the login scripts –re-executing the original query as a script t will now get the same output as the New & Improved version – as shown here:
As to the difference between GLOGIN.SQL and LOGIN.SQL – SQL*Plus provides two automatic script environmental setup options. LOGIN.SQL is for a particular user and is loaded from one of their local directories, whereas GLOGIN.SQL is more for departmental or enterprise wide standards and usually kept on shared file servers.