Editor moves to top on execution of a script

How can I avoid the annoying behavior of the editor (TOAD 17.1 for Windows) that, after the execution of a script (creation of a package for example), whether it is failed or successful, moves the cursor to the first line?
It is a nuisance because it causes you to lose the point where the edit was and forces you to search for it again manually or set a marker before execution.

Thank you. Greetings.

I just tested F5 with the following script:

select * from emp;




-- this is where I am


select * from dept;
select * from dual;

The cursor was at the comment when I hit F5. When script execution finished, it was still there.

After that I tried with a single "create package body" in the editor and for me it still stayed in the same place.

If your script is only a single "Create" statement, then you should use "Execute/Compile (F9)" instead of "Execute Script (F5)". That may solve your problem.

Thank you!

I have verified that the problem only occurs when there is an error in the code of the package that is created.
I thought that what I was doing from TOAD was executing the package creation script (F5) and that the result of this was that the database received the code and compiled it. It seems that to "notify" TOAD that this is what I am going to do, I have to use the other button (F9) that executes the creation statement "create or replace...".
Since I'm used to using F9 to execute SQL statements and F5 to "compile" packages, I guess I'll have to make an effort to change my habit.
In any case, I have been using previous versions of TOAD for many years and I don't seem to remember it behaving like this before.

Thank you so much. Greetings.

1 Like

In general, if you are only running a single statement, as opposed to a script when you want one statement after the next to run, you should use F9.

You can read more about why here (although that post is more about SELECT than Create or Replace statements).