I have some 800-1200 INSERT statements generated from an excel sheet. I want to run these in TOAD - Oracle db.
If I press F9, it runs only one line and F5 gives me syntax issue and do not seem to work? What am I missing here?
In SqlDeveloper preferences: Tools > Preferences > Database > Worksheet check the option for New Worksheet to use unshared connction . This will allow you to execute multiple queries at the same time, each in each tab.
Shift-F9 executes the current SQL statement. If you are working with SQL in a script, highlight the SQL in the script and press F9 to execute the single SQL statement only.
F9 executes only one statement. By default Toad will try to execute the statement wherever your cursor is or treat all the highlighted text as a statement and try to execute that. A ;
is not necessary in this case.
F5 is "Execute as Script" which means that Toad will take either the complete highlighted text (or everything in your editor if nothing is highlighted) containing more than one statement and execute it like it was a script in SQL*Plus. So, in this case every statement must be followed by a ;
and sometimes (in PL/SQL cases) ended with a /
.
Wrap the multiple statements in a BEGIN END block to make them one statement and add a slash after the END; clause.
BEGIN insert into books (id, title, author) values (books_seq.nextval, 'The Bite in the Apple', 'Chrisann Brennan'); insert into books (id, title, author) values (books_seq.nextval, 'The Restaurant at the End of the Universe', 'Douglas Adams'); END; /
That way, it is just ctrl-a then ctrl-enter and it goes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With