I had been using Execute Current Statement (F9) instead of Execute SQL (F5). I’m not exactly sure what is considered the “Current Statement” but it seems to ignore the variable declaration unless my cursor is before the variable declaration. This is different from how Execute Current Statement (F9) works in Toad for SQL Server where it does execute the variable declaration.
This is not a bug and that is why things are not changing. This is original behavior from Toad for Oracle.
There are different execution needs depending on what you are doing.
When you have a script you might want to only execute the SQL you are working on. For this you use F9 and we figure out what the current statement is based on your cursor and only execute that.
Or when you have a script you might want to execute all in the script from top down. For this you use F5.
There is a third option which is to execute from the current statement to the end. For this there is a menu action but no hot key.
In the case of a SQL that contains a script variable you can’t execute the current statement as the variable must be declared in block of code that is being sent to the server. So in this case F5 is the only option.
I don’t see a bug here however I am all ears if you think I have missed something