ORA-00911: invalid character Toad
Asked Answered
G

2

3

I am using Toad 11.5

when I run multiple truncate statement, it gives an error ORA-00911: invalid character

truncate table employees;
truncate table employees_edit_history;
truncate table sourcecontributioncalc;

but when I run it one bye one , it execute successfully! Why toad giving an error when I run all statements once?

and any solution for that ?

Gorgerin answered 12/4, 2014 at 10:36 Comment(2)
Are you running as a statement (F9) or running multiple statements as a script (F5)? I suspect you're just using the wrong command.Ataghan
@AlexPoole oh yeh! Actually I press the left corner button which is execute statement(F9), this create the problem! When I press F5 (Execute as script ) then fine. thanks! put yor answer I will accept! :)Gorgerin
A
4

When you run it as a statement (F9) you can't have multiple statements, and the semicolons are meaningless - as they are statement separators. (You get the same error with a semicolon in an execute immediate or JDBC call, for example, as they only support a single statement).

If you run as a script (F5) instead then those separators do have meaning, and the multiple statements that they, er, separate will be executed in sequence.

Ataghan answered 12/4, 2014 at 17:31 Comment(1)
The semicolons do have a meaning to Toad, internally. The parser uses them to accurately detect all code in the Editor and populate the Navigator. It also allows for multiple statements to exist in the Editor and have the correct one executed with F9 by simply placing the caret on it and not selecting it. You can also separate statements by blank lines and use CTRL+Enter or Shift+F9, but it is not the same as F9 execution. This topic has been discussed in great detail on the Toad forums over the years.Jamal
M
0

did you copy & paste these statements from somewhere else? sometimes copying statements is copied with invisible characters, this happend when copying between unix and windows for example, because the end line character in each OS is different.

rewrite these statements by hand could solve this problem.

Mayan answered 12/4, 2014 at 10:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.