Hello, you are not logged in.  Login or sign up
Community >> Blogs
Search Toad World Search

Blogs
Toad and Database Commentaries

 Toad World blogs are a mix of insightful how-tos from Quest experts as well as their commentary on experiences with new database technologies.

Do you have a topic that you'd like discussed?  We'd love to hear from you.  Send us your idea for a blog topic.

Making Toad Do What You Want
 
Location: Blogs Bert Scalzo's Blog    
 Bert Wednesday, June 25, 2008 8:55 AM
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.
 
Permalink |  Trackback

Comments (3)   Add Comment
By GregA on Wednesday, June 25, 2008 2:40 PM
When I run a query, the result appears in the "Grid 1" tab. How do you get something to appear in the "output" tab as above?

By BBoise on Friday, June 27, 2008 4:16 AM
GregA it sounds like you're executing as a statement (F9) as opposed to a script (F5). If you execute as a script, you should see your output in the tab as shown above. Hope this helps.

By bscalzo on Tuesday, July 01, 2008 7:36 AM
yes - that sounds correct - make sure you are doing an execute as script (f5) and not an execute statement (f9). The former means to run the collection of statements - whereas the latter means to just run one statement.


Comment:
Add Comment   Cancel 
Search Blog Entries
 
Blogger and Topic List
 

 

All Recent Entries
 

 

Johannes Ahrends
Unicode

Steven Feuerstein
Oracle PL/SQL

Daniel Norwood
Toad for Data Analysts
John Pocknell
Toad for Oracle
Bert Scalzo
Toad for Oracle, Data Modeling, Benchmarking
Jeff Smith
Toad product family
Richard To
SQL Optimization
Jim Wankowski
DB2 - LUW and z/OS
John Weathington
Compliance
Doug Williams
Database Musings
  Henrik "Mauritz" Johnson
Toad Tips & Tricks on the "other" Toads
  Toad World Editor
Toad World issues

  Toad Data Modeler Opens in a new window
Data Modeling
 

Copyright 2008 by Quest Software  | Terms Of Use | Privacy Statement | Contact Us