SQL*Plus contains its own line editor to make quick changes to SQL code.
While too clumsy for editing more than a few lines of SQL or PL/SQL code, it can save time when you are debugging ad-hoc queries or other short SQL commands. The SQL*Plus editor is similar to the UNIX line editor called ed. The following table lists the editing commands available.
SQL*Plus saves the current command in its buffer. You can modify the text in the buffer by using these commands:
If you want to run SQL*Plus from your desktop client machine, select the SQL Plus program option from the Application Development menu option under the Oracle software menu option. This starts SQL*Plus. (Note that you do not type the * that is in the middle of the official product name, and the asterisk does not appear in the program name, either.) Because Oracle is careful to guard who can access the data it stores, it requires that you enter an ID and password to connect to it. Oracle will display a copyright message and then ask for your username and password.
Log into your database using the account and password you created to hold the sample tables. If you provide a valid username and password,
SQL*Plus will announce that you are connected to Oracle and then will display this prompt:
SQL
You are now in SQL*Plus, and it awaits your instructions.
Many application development environments provide direct SQL access to Oracle databases. The SQL commands shown in this module will work from within those tools, but the commands specific to
SQL*Plus (such as describe) will not.
If the command fails, there are several potential reasons: Oracle is not in your path, you are not authorized to use SQL*Plus, or Oracle has not been installed properly on your computer.
If you get the message
ERROR: ORA-1017: invalid username/password; logon denied
either you have entered the username or password incorrectly or your username has not yet been set up properly on your copy of Oracle.
After three unsuccessful attempts to enter a username and password that Oracle recognizes, SQL*Plus will terminate the attempt to log on, showing this message:
unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
If you get this message, contact the database administrator of your company.
Assuming everything is in order, and the SQL> prompt has appeared, you may now begin working with SQL*Plus. When you want to quit working and leave SQL*Plus, type this:
quit
or
exit
The next lesson shows another way to edit your SQL*Plus commands.