whenever SQLERROR EXIT ROLLBACK give ORA-00900: invalid SQL statement in TOAD Editor

In TOAD Editor, when I run WHENEVER SQLERROR EXIT ROLLBACK, I get the following error [Error] Execution (5: 1): ORA-00900: invalid SQL statement.

Is there some setting I need to adjust for this to work ?

Oracle database ver 9.2.0.8

TOAD ver 12.1.0.22

Thanks for any feedback.

Well, that’s because it’s not a valid SQL statement. :slight_smile:

WHENEVER is a SQL*Plus command. It’s meant to be used with scripts (bail out of there’s an error).

If you are running a script in Toad, run it in the Editor with F5 and you won’t get an error on this command.

If you are just running individual commands, you can run them with F9, but there’s no need to run WHENEVER commands that way because they don’t apply in that context.

Sounds like you are running with F9, which is meant for individual SQL commands, which is why you are getting an error.

John,

Thanks. That may be it.

I ran as a script F5 and nothing seemed to have ran, so I tried running that line with F9 since it was the first command/line.

Seemed like there was an error in the next sql which caused all others to stop running. Fixed that error and script is running now.

Thanks for the quick update.