RelationalDBDesignRelationalDBDesign



SQL Extensions   «Prev 

To start SQL*Plus and connect to the default database

  1. Open a UNIX or a Windows terminal and enter the SQL*Plus command: sqlplus
  2. When prompted, enter your Oracle Database username and password. If you do not know your Oracle Database username and password, ask your Database Administrator.
  3. Alternatively, enter the SQL*Plus command in the form: sqlplus username
    You are prompted to enter your password.
  4. SQL*Plus starts and connects to the default database. Now you can start entering and executing SQL, PL/SQL and SQL*Plus statements and commands at the SQL> prompt.
To start SQL*Plus and connect to a database other than the default
Open a UNIX or a Windows terminal and enter the SQL*Plus command:
sqlplus username@connect_identifier
You are prompted to enter your password.

Using Text Editor with SQL*Plus

SELECT FIRSTNAME, LASTNAME
FROM CUSTOMER C
WHERE C.CUST_ID
IN (1,2,3,4)
Here is the query that you created in the simulation in the previous lesson. This time the query will be changed quite a bit, so it is better to use the text editor method.

To invoke the text editor, type EDIT and press ENTER

SQL*Plus places the current query into a file and opens the file with the text editor.

After adding some lines to the query and modifying the SELECT clause, the query is ready to test. Clicking the X in the top right corner of Windows Notepad closes the editor.

Notepad displays a window asking you to save changes. Clicking the Yes button saves the changes.

SQL*Plus writes the contents of the file into the current buffer and displays it in the SQL* Plus window.

Type a forward slash and press ENTER to execute the query.

You have an error in your code. Type EDIT and press ENTER to go back to the text editor.

The corrections have been made using the text editor. Once again, click the X in the top right corner to close the text editor.

Notepad asks about saving your changes. Click the Yes button to save changes and return to SQL* plus.

The modified query is now ready to execute in SQL* Plus. Type a forward slash and press ENTER to execute.

The query successfully executes and displays the results