Oracle SQL*Plus
Common Commands: |
|
| PASSWORD | Changes the password for the current user. Alternatively, on older Oracle servers, PASSWORD is not recognized as a command, so you have to work around with ALTER USER username IDENTIFIED BY password. |
| @ | You can use @ to call a SQL script. If you downloaded the demo.sql SQL script into your SQL directory, you can execute it by typing @Z:\SQL\demo.sql (or just @Z:\SQL\demo, if you do not specify the file extension, SQL*Plus will assume it is .sql) |
| TAB | To check which tables you have in the database under your account, you can check the tab table (strictly speaking, tab is not a table, but more about this in time to come), by typing SELECT * FROM TAB; |
| DESC | Shorthand and a synonym for DESCRIBE. Shows the columns in a table with the appropriate datatypes, and constraints, if appropriate (if a particular field nullable, for example). |
| HOST | Opens a shell window. |
| EDIT | Edits the last typed SQL command. Useful if you made a typo and do not want to demonstrate your typing skills over and over again. Notice that edit brings back the last SQL command, not the SQL*Plus command. (What is the difference between a SQL and a SQL*Plus command?) |
| / | Executes the last SQL command once again. |
| SET/SHOW | Sets and displays SQL*Plus settings. Two of the basic settings are LINESIZE and PAGESIZE. You can also type SHOW ALL to see all settings in SQL*Plus. |
| COMMENTS | There are several ways to specify a comment inside a SQL
script: -- This is a comment rem This is another way to specify a comment remark This is another way to specify a comment /* This is another way to specify a comment */ |
| PROMPT | At this moment think of PROMPT as a command which echoes to the screen whatever you type after it. So PROMPT yourname outputs yourname to the screen. |