Solved

toad F5 select results not the same as F9 select results

Posted on 2010-09-21
12
1,772 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
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
 
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now