Difference between 'Execute' and 'Execute as script'
I'm currently experiencing what I开发者_如何学JAVA believe is strange behavior when using Oracle with TOAD.
I have a query:
SELECT
COUNT(as_at_date)
FROM
job_log
WHERE
as_at_date = TO_DATE('24/11/2009', 'dd/mm/yyyy');
When I try to run this using Toads 'Execute statement' button I get zero rows returned. However when I use 'Execute as script' I get one row returned, which is as expected.
Can anyone explain to me why using the different commands would produce differences in the result set?
Thanks.
It's not an direct answer to your question (and it will take you a moment or two to setup and analyse), but you could take a TKPROF trace in the database to see what actually arrives from Toad....
See
http://www.jlcomp.demon.co.uk/tkprof_01.html
and
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:969160000346108326
for some examples.
Execute will run the query where the cursor is present.
Execute as script will execute all the queries written in that tab from top to bottom.
Probably when pressed "EXECUTE" button the cursor would have been in an empty line.
精彩评论