Entering and Executing SQL Statements and Commands

Previous
Previous
Next
Next

To enter and execute SQL statements or commands, enter the statement or command at the SQL prompt. At the end of a SQL statement, put a semi-colon (;) and then press the Enter key to execute the statement. For example:

SQL> SELECT * FROM employees;

If the statement does not fit on one line, enter the first line and press the Enter key. Continue entering lines, and terminate the last line with a semi-colon (;). For example:


SQL> SELECT employee_id, first_name, last_name
  2  FROM employees
  3  WHERE employee_id >= 105 AND employee_id <= 110;

The output from the previous SELECT statement is similar to:


EMPLOYEE_ID FIRST_NAME           LAST_NAME
----------- -------------------- -----------------------
        105 David                Austin
        106 Valli                Pataballa
        107 Diana                Lorentz
        108 Nancy                Greenberg
        109 Daniel               Faviet
        110 John                 Chen
6 rows selected.

Note that a terminating semi-colon (;) is optional with SQL Command Line commands, such as DESCRIBE o r SET, but required with SQL statements.