Solved

toad F5 select results not the same as F9 select results

Posted on 2010-09-21
12
1,832 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.

816 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

10 Experts available now in Live!

Get 1:1 Help Now