- 论坛徽章:
- 0
|
edit问题
再贴一个关于sqlplus的简单介绍
SQL Plus Commands
[Introduction |Line Editing |Using Notepad for editing |Sending results to a file |Retrieving a file ]
Introduction
At the SQL prompt, you can begin typing any SQL command. Upon hitting return (i.e., enter key) the SQL prompt will change to line number prompts. When you are finished typing a command, type / or RUN to execute the SQL command. Also, a semicolon at the end of the SQL command will execute the command immediately after hitting return. In addition to SQL commands, /, and RUN, other commands can be issued at the SQL prompt (a semicolon does not have to follow the nonSQL commands).
DESCRIBE tablename--lists the attributes and their specifications of tablename
EDIT--Places you in an editor (Notepad). The buffer contents are put into the editor
GET filename--Retrieves a file and places it into the buffer
SAVE filename--Saves the buffer to the name file
CLEAR BUFFER--Clears the buffer
--------------------------------------------------------------------------------
Line Editing
One way to change an SQL statement in the buffer is by using the line editor. The following are a list of line edit commands.
LIST or L--Lists the contents of the buffer
LIST n or L n--Lists the contents of line number n in the buffer and makes the line current
LIST * or L *--Lists the current line
LIST m n--Lists the range from m to n line
Append text or A text--Adds to the end of the current line (e.g., "A ," adds a comma to the end of line
INPUT or I--Adds one or more lines after the current line so you can begin adding the text.
CHANGE /text--Deletes text from the current line
CHANGE /oldtext/newtext--Replaces oldtext with newtext in the current line
DEL -- Deletes the current line
Using Notepad for Editing
You can use Notepad to edit the contents of the buffer. There are two ways to enter Notepad.
Use the menus Edit/editor/invoke. In addition here, you can use Edit/editor/define to change the editor. You might check Edit/editor/define prior to editing a buffer to make sure it is set up the way you would like.
Type Edit at the SQL Prompt
When you are finished editing, click on File/exit (in Notepad). Next, type GET buffername at the SQL prompt. The buffer name will be listed a few lines up in SQL Plus upon returning to SQL Plus. Type RUN, to execute the command.
Notepad can also be used to save the buffer contents. Use File/Save As to create a permanent file.
Multiple SQL commands can be typed in Notepad. End each SQL command (except the last one) with a semicolon. After exiting notepad, type Start buffername instead of GET buffername to run all of the commands. Start filename can also be used to execute SQL command that are stored in a file.
Sending the Results to a File
To send queries and their results to a file for later printing (e.g., turning in homework assigments), the spool command is used. On the menu go to FILE/Spool to begin spooling--it will ask for a file name. To quit spooling, go to FILE/Spool and then click on end Spool.
Retrieving a File
To retrieve SQL command from a file use GET filename or START filename. GET filename places the file into the buffer. START filename executes the commands in the file. |
|