Link to home
Start Free TrialLog in
Avatar of spiral2007
spiral2007

asked on

toad F5 select results not the same as F9 select results

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!
Avatar of Naveen Kumar
Naveen Kumar
Flag of India image

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
Avatar of spiral2007
spiral2007

ASKER

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

F5 is for executing as script, while F9 says execute statement. can you show us the sql stmt your are running?
what is the output you are getting for that query when you use F5 and when use F9 ?
F5 results

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

2 rows selected.

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

550
24900
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,
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...
ASKER CERTIFIED SOLUTION
Avatar of Bigboj
Bigboj
Flag of Hungary image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
t
i don't want to close the question , i just want to accept multiple answers by nav_kum_v and Bigboj.

??