SQL Extensions   «Prev 

Using SQL*Plus Editor Commands

  1. Let us assume that you have typed in a query and run it, getting the syntax error you see here. You need to change C.CUST_IN to C.CUST_ID. Begin by making line 3 (the line with the error) the current line. Do this by typing L 3 at the SQL> prompt and pressing Enter.
  2. Now you see line three of your buffer displayed. The next step is to change the incorrect column name. Use the CHANGE command to do this. Type C/IN/ID/ and press Enter.
  3. The line has been changed as you specified. Before you execute the query, list the entire buffer so you can see what the entire query looks like. To view the entire query, simply type L and press Enter.
  4. Here you see the query. There are four lines, numbered one through four. The line with the asterisk (*) is the current line in the buffer.The query looks okay, so execute the query now by typing a forward slash (/) and pressing Enter.
  5. The results of the query are displayed on the screen. You have succeeded in correcting the syntax error. This is the end of the simulation. Click Exit.

Direct SQL access

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: