Solved

toad F5 select results not the same as F9 select results

Posted on 2010-09-21
12
1,926 Views
Last Modified: 2012-05-10
Hello experts,
I have a "select sum(Something) from x_table union sum(Something) from y_table" query and when i am executing it with f5 i get different result than executing it with f9. The F9 execution is the right one

how can i get the same results?In my vb.net application i'm getting the f5 results.

Thanks in advance!
0
Comment
Question by:spiral2007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 33723721
i can get the same results for a sample query which i tried both with F5 and F9.  

But f5 is for executing a script which can even have just one sql statement in the query.

what is the exact query.. are there any other statements present in the toad window when you press f5 ?

Thanks
0
 

Author Comment

by:spiral2007
ID: 33723738
here is the query
Select sum(MANUAL_AMOUNT) from CODINSTR.FOROLOGIA_ADDRESS_DIMOTIS inner join CODINSTR.DOG on DOG.DOG_ID = FOROLOGIA_ADDRESS_DIMOTIS.DOG_ID inner join CODINSTR.DOG_CHARGE_CATEGORY ON DOG_CHARGE_CATEGORY.DOG_CHARGE_CATEGORY_ID = DOG.DOG_CHARGE_CATEGORY_ID    Where ( DOG.DOG_CHARGE_CATEGORY_ID = 1 or  DOG.DOG_CHARGE_CATEGORY_ID = 2 or  DOG.DOG_CHARGE_CATEGORY_ID = 3 or  DOG.DOG_CHARGE_CATEGORY_ID = 4 or  DOG.DOG_CHARGE_CATEGORY_ID = 5 or  DOG.DOG_CHARGE_CATEGORY_ID = 6)

union 

Select sum(MANUAL_AMOUNT) from CODINSTR.forologia_company_dieuthinsi  inner join CODINSTR.DOG on DOG.DOG_ID = forologia_company_dieuthinsi.DOG_ID inner join CODINSTR.DOG_CHARGE_CATEGORY ON DOG_CHARGE_CATEGORY.DOG_CHARGE_CATEGORY_ID = DOG.DOG_CHARGE_CATEGORY_ID   Where ( DOG.DOG_CHARGE_CATEGORY_ID = 1 or  DOG.DOG_CHARGE_CATEGORY_ID = 2 or  DOG.DOG_CHARGE_CATEGORY_ID = 3 or  DOG.DOG_CHARGE_CATEGORY_ID = 4 or  DOG.DOG_CHARGE_CATEGORY_ID = 5 or  DOG.DOG_CHARGE_CATEGORY_ID = 6)

Open in new window

0
 
LVL 7

Expert Comment

by:sumit2906
ID: 33723742
F5 is for executing as script, while F9 says execute statement. can you show us the sql stmt your are running?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 33723838
what is the output you are getting for that query when you use F5 and when use F9 ?
0
 

Author Comment

by:spiral2007
ID: 33724142
F5 results

SUM(MANUAL_AMOUNT)
------------------
             307.5
          14271.36

2 rows selected.

----------------------------------------------------
F9 results

550
24900
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 33724160
Can you give me exactly whatever is there in the toad script window before you press F5 or F9 to see whether some ; missing at some statement or something else is causing this. Probably just save it as an attachment and upload here.

Thanks,
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 33724176
just to test it.. can you just run the query in sqlplus and let me know what is the ouput you get in sql*plus...
0
 
LVL 3

Accepted Solution

by:
Bigboj earned 250 total points
ID: 33732964
This can happen if You set the "Current Schema" combo, or any of the session-related settings in TOAD
This settings are affect only SQLs executed as single statement.
By default, for script execution, TOAD opens a new session with the server-defaults of session settings.
0
 
LVL 28

Assisted Solution

by:Naveen Kumar
Naveen Kumar earned 250 total points
ID: 33733183
I understand what Bigboj is saying and may be that is the reason.

To avoid that, you can simply do a commit in the toad window and retry to check with both F5 and F9 ? This should get you the same data.
0
 

Author Comment

by:spiral2007
ID: 33734945
t
0
 

Author Comment

by:spiral2007
ID: 33735120
i don't want to close the question , i just want to accept multiple answers by nav_kum_v and Bigboj.

??
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question