Toad World® Forums

Multiple Queries

When I run multiple queries in the same window like this:

select * from brand b;

select * from blog;

I only see the results for the last query, in this case “Blog”. The window at the top says “2 statements processed” but I’m not seeing two results sets.

The result generated would be based on the option used to run SQL statements. Which of the following options is used to run the multiple SQL statements?

  1. Execute All Statements
  2. Execute from Current Position
  3. Execute To Current Position
  4. Execute SQL Statement
    If the cursor is not positioned on any SQL Statement and Execute All Statements is selected no result set is displayed.

To run multiple SQL queries:

  1. Add multiple SQL Queries in same worksheet.

  1. Position cursor at the start of the 1st SQL Statement and click on Execute SQL Statement.

  1. Result from 1st SQL Query is displayed.

  1. Position cursor at the start of 2nd SQL statement and click on Execute SQL Statement.

  1. Result from 2nd SQL Query is displayed.

Hi Thomas,

Unfortunately, you cannot view results of multiple select statements in one query at the moment. If you need to do that, you will have to display them one by one as per Deepak’s walkthrough.

I created a CR for this improvement in our backlog so it might be implemented at some time in the future.

Thank you,

Lukas

Thank you for the detailed response Deepak, but I’m well aware of how it’s possible to get the results I want in 5 separate steps but it shouldn’t be that hard. Toad for MySQL gets it done in one.

That would be great Lukas. I appreciate that Toad Edge is probably a complete re-write and I love that it’s native to the Mac but there are number of ways in which using it is more difficult. To the point where I’m still willing to run Windows through Parallels for the sole purpose of using Toad for MySQL.

If none of the transactional limitations being added multiple SQL statements should be able to be run in the same transaction.

http://download.nust.na/pub6/mysql/doc/refman/5.1/en/mysql-cluster-limitations-transactions.html

TOAD for MySQL does display two results for two SQL SELECT statements in the same run. Would be a suitable feature to add to TOAD Edge also.

Toad Edge should also save Result tabs of past queries per session like Toad for MySQL did.

hear hear!

Past queries would be suitable as Results History, but only for a Session.

It doesn’t tell you the run time. So if I want to compare how long one stored procedure took and then make some changes and run it again, I have to physically write down the time. If I want to check the results of two queries or procedures are the same I need to export the data to compare them.

Toad Edge does provide Schema comparison.

www.quest.com/…/

Regarding comparing time for query the time would vary even for the same query over multiple runs. Has running same query over multiple runs been tested? Time for query could vary due to several factors such as:

-Other queries running concurrrently
-CPU and RAM available
-Other processes running
-Whether single thread or multiple thread CPU is used

Hi,

Schema comparison is not relevant to this issue. I am looking at queries in the same database and not schema changes.

This has to do with development. I always used the toad freeware because it was excellent for development purposes (ie stored procedures, functions etc.) which is a big part of applicative side of the job of a DBA. The only reason I looked at toad Edge is because it has the tendency to freeze and crash and sometimes lose things I needed.

When running a call to a stored procedure and making changes - as you may be changing the code to fix an issue, add support for additional input variables or optimize the run time, to give some examples, the results can be different if you mess something up in the logic. The data can be slightly different based on the changes in the incoming variables (such as for example if you change parameters like order by and row limits). Sometimes something you add will slow down or speed up the runtime and you want to check back between versions. Sometimes you just need to make sure the data with one version is the same with the new version of the stored procedure. These are the main reasons why I liked to check the data and run times of previously run queries. Sometimes I forgot the parameter I got from an earlier query and wanted to go back to check that the information was correct or consistent without having to run the query over again in another window so as not to lose the data I was looking at.

I hope this explains the issue more clearly.

Additionally I find when I go some googling that the features that Toad Edge for MySQL are lacking exist in the version for SQL Server so I know that these are things that are important to other people using the software.

Thanks.

Regarding support for multiple Results refer Lukas Knapek’s reply:

“I created a CR for this improvement in our backlog so it might be implemented at some time in the future.”