Database Components   «Prev 

SQL*Plus

SQL*Plus is a tool used to enter SQL commands and display the output. It is provided with every Oracle installation, whether on Windows, Unix, or Linux. It is a command line interface and supports editing, user input, and report formatting.
In 11g, SQL*Plus for Windows (sqlplusw.exe) is no longer part of the client or database install. The command line version (sqlplus.exe) is still available. You can use an older version of SQL*Plus for Windows to connect to an 11g database, but some functionality may not be supported. SQL Developer is a GUI interface that is shipped with 11g and should be considered the replacement for SQL*Plus for Windows.
To start SQL*Plus, simply type ‘sqlplus’ at the command prompt or after starting a DOS command session in Windows. Under normal circumstances, SQL*Plus prompts you for a username and corresponding password. If you are able to provide a valid username/password combination, the SQL> prompt appears on your screen to indicate that you have successfully established a session. You can also start SQL*Plus with the username and password at the command line, as shown in Figure 2-4. In this case, if the username/password are valid, the SQL> prompt will appear. If not, you will be asked to enter a valid username and password.

Figure 2-4: SQL*Plus screen after a successful connection using the username/password at the command line

Log into SQL*Plus

  1. On Windows, click the Start button, then choose Programs.
  2. Choose Application Development.
  3. Choose SQL Plus.
  4. Type a valid username, password, and service. For this simulation, we will use the sample username that contains the course project tables.
  5. Click the OK button.
  6. Type a query in the window, starting at the SQL> prompt. Use this query:
    SELECT LASTNAME FROM CUSTOMER;
    
    End your query with a forward slash on a single line. This tells SQL*Plus to execute the query.
  1. SQL*Plus displays the results of the query. Now type EXIT and press Enter to close SQL*Plus.