Sometimes, the result from a query will not fit the available page width. The headings may be repeated in your output, depending on the setting of a system variable called PAGESIZE.
If you made a mistake and therefore did not get the results shown above, simply re-enter the command. SQL*Plus processes the command and displays the results on the screen:Īfter displaying the results and the number of rows retrieved, SQL*Plus displays the command prompt again. The semicolon ( ) means that this is the end of the command. Enter the second line of the command:įROM EMP_DETAILS_VIEW WHERE SALARY > 12000 SQL*Plus will display a "2", the prompt for the second line.When you are done, press Return to move to the next line. If you make a mistake, use Backspace to erase it and re-enter. SELECT EMPLOYEE_ID, LAST_NAME, JOB_ID, SALARY At the command prompt, enter the first line of the command:.In this example, you will enter and execute a SQL command to display the employee number, name, job, and salary of each employee in the EMP_DETAILS_VIEW view. See your Oracle9i SQL Reference for information on individual SQL commands. The SQL command language enables you to manipulate data in the database. See Appendix D, "Commands Not Supported in iSQL*Plus" for a list of SQL*Plus commands not supported in iSQL*Plus. Some SQL*Plus commands have no logical sense or are not applicable in iSQL*Plus. If you use the History screen to re-execute a script, you may get different results from those previously obtained, depending on the current system variable values. ISQL*Plus retains the state of your current system variables and other options from one execution to the next. If you intend to run iSQL*Plus scripts in the SQL*Plus command-line, you should make sure you use a " " or "/" to terminate your statements. ISQL*Plus executes a SQL or PL/SQL statement at the end of the Input area, even if it is incomplete or does not have a final " " or "/". Use the History screen to access and rerun commands previously executed in the current session. The results of your script are displayed below the Input area by default. In iSQL*Plus, you type a command or a script into the Input area and click the Execute button to execute the contents of the Input area. SQL*Plus processes the command and re-displays the command prompt when ready for another command. In command-line SQL*Plus, you type a command and direct SQL*Plus to execute it by pressing the Return key. SQL*Plus does not store SQL*Plus commands, or the semicolon or slash characters you type to execute a command in the SQL buffer. For more information about editing or re-running a command or block stored in the buffer see "Running Scripts". If you want to edit or re-run the current SQL command or PL/SQL block, you may do so without re-entering it. The command or block remains there until you enter another.
The area where SQL*Plus stores your most recently entered SQL command or PL/SQL block (but not SQL*Plus commands) is called the SQL buffer. Saving and loading scripts may be useful when editing and testing. You can also load scripts with the Load Script button. In iSQL*Plus, the Save Script button enables you to save scripts to a text file. You can also cut or copy scripts or statements from other applications such as text editors, and paste them directly into the Input area. In iSQL*Plus, you can cut and paste using your web browser's edit keys to edit the statements in the Input area. You can use the Backspace and the Delete keys in both command-line SQL*Plus and iSQL*Plus.
Examples of how to run and execute these types of commands are found on the following pages. The manner in which you continue a command on additional lines, end a command, or execute a command differs depending on the type of command you wish to enter and run.
You can enter three kinds of commands in either the command-line or the iSQL*Plus user interfaces: For the sake of clarity, all table names, column names, and commands in this guide appear in capital letters. You can use additional spaces or tabs between words to make your commands more readable.Ĭase sensitivity is operating system specific. Usually, you separate the words in a command from each other by a space or tab. In command-line SQL*Plus, you type commands at the SQL*Plus prompt. Unless stated otherwise, descriptions of command use are generally applicable to both command-line and iSQL*Plus user interfaces.
This chapter helps you learn the basics of using SQL*Plus, including the following topics: