DB Creation   «Prev  Next»

Lesson 8 When you make a mistake
Objective Learn how to recover from a misspelled command.

How to recover from Errors in Oracle

Mistakes made at the command Line

It is easy to mistype a command while you are using Server Manager, and suddenly find yourself in a situation where Server Manager keeps accepting text, but refuses to actually do anything no matter what you type. That situation typically looks like this:
SVRMGR> exite
2> exit
3> quit

Reasons for Server Manager's behavior

Here is what is happening in the above situation. Server Manager is designed to let you enter and execute SQL statements. SQL statements may be many lines long, and Server Manager must allow for this. When you type in a command that is not one of the few Server Manager specific commands, such as help or exit, the program assumes that you are entering an SQL statement. Once Server Manager thinks that you are entering an SQL statement, it accepts and buffers all text that you type until you terminate the statement, usually with a semicolon. Only at that point does it try to execute the statement.

How to rectify your mistake

The solution to the problem of mistyping a command is to enter a semicolon to terminate the statement, accept the error that occurs, and retry your command. When you do this, Server Manager returns the word it doesn't recognize. Here is an example showing how to recover from the mistyped exit command shown earlier:

Example of Mispelled Command

SVRMGR> exite
2> exit
3> quit
4> ;
ORA-00900: invalid SQL statement
SVRMGR> exit
Server Manager complete.

If you are curious as to why SQL * Plus can not recognize exite as a bad command, read this explanation.