Once you re logged on to the database using SQL*Plus, try entering the following SELECT statement that returns the current date from the database:
SELECT SYSDATE FROM dual;
SYSDATE is a built-in Oracle function that returns the current date, and the dual table is a built-in table that contains a single row. You can use the dual table to perform simple queries whose results are not retrieved from a specific table.
Note | SQL statements directly entered into SQL*Plus are terminated using a semicolon character (;). |
Figure 1-3 shows the results of this SELECT statement in SQL*Plus running on Windows.
As you can see from the previous figure, the result of the query displays the current date from the database.
You can edit your last SQL statement in SQL*Plus by entering EDIT . This is useful when you make a mistake or you want to make a change to your SQL statement. In Windows, when you enter EDIT you are taken to the Notepad application; you then use Notepad to edit your SQL statement. When you exit Notepad and save your statement, the statement is passed to SQL*Plus where you can re-execute it.
Note | You ll learn more about editing SQL statements using SQL*Plus in Chapter 5. |