Last time we introduced:SQL/PLUS Study NotesSQL Buffer, this time we will mainly introduce the content of SQL/PLUS learning notesAutomatic SQL submissionNext, let's take a look at this part.
Automatic SQL submission
The automatic SQL submission function is disabled by default, which is more reasonable to avoid rollback during misoperation;
You can enable the automatic SQL submission function by setting the autocommit parameter:
For example:
- SQL> show auto
-
- autocommit OFF
-
- SQL> set auto on
-
- SQL> insert into t_1 values(51,'Heihei');
One row has been created.
Submitted.
Otherwise, the records inserted by the current user are indicated to be saved in the memory without commit, and only the current user can select other users, which is invisible to other users.
Edit script
Run the define command to view the environment variables that can be set in SQL/PLUS.
- SQL> define
- DEFINE _ DATE = "14-8-11" (CHAR)
- DEFINE _ CONNECT_IDENTIFIER = "orcl" (CHAR)
- DEFINE _ USER = "EMC" (CHAR)
- DEFINE _ PRIVILEGE = "" (CHAR)
- DEFINE _ SQLPLUS_RELEASE = "1002000100" (CHAR)
- DEFINE _ EDITOR = "Notepad" (CHAR)
- DEFINE _ O_VERSION = "Oracle Database 10g Enterprise Edition Release 10.2.0.
- 1.0-Production
- With the Partitioning, OLAP and Data Mining options "(CHAR)
- DEFINE _ O_RELEASE = "1002000100" (CHAR)
The default Script editor can be set for _ editor. After setting, enter the command: SQL> edit file. SQL to edit the script file. If no path is specified, the file is saved in the current path of the operating system. You can also switch
In the operating system command environment, edit the script and run it in the path of @, @ or start + script.
For example:
- SQL> edit file -- file. SQL file is generated in the current directory by default, or you can switch to the operating system, edit the script, and run the script. The extension is SQL by default;
- SQL> $
- Microsoft Windows XP [version 5.1.2600]
- (C) Copyright 1985-2001 Microsoft Corp.
- C: \ Documents ents and Settings \ hawk> dir
- The volume in drive C is C
- The serial number of the volume is 4D28-FE45
- C: \ Documents ents and Settings \ hawk directory
- <DIR>.
- <DIR> ..
- <DIR> Start Menu
- <DIR> My Documents
- <DIR> Favorites
- <DIR> Desktop
- <DIR>. myeclipse
- <DIR>. m2
- 128. myeclipse. properties
- MagicEmotions. idx
- 25. pulse2.locator
- <DIR> EurekaLog
- 225,685 sqlnet. log
- <DIR> workspace
- 89 afiedt. buf
- <DIR> Tracing
- File. SQL -- enter select * from t_1 in it; then save
- 6 files in 225,953 bytes
- 8,195,407,872 available bytes in 11 Directories
- C: \ Documents ents and Settings \ hawk> exit -- enter the exit command to return to sqlplus
- SQL> @ file -- run the script. The execution result is shown below. The input @ file or start file is the same.
- ID NAME
- ------------------------
- 1 Taowei
- 2 Taowei
- 3 Taowei
- 4 Taowei
- 5 Taowei
- 6 Taowei
- 7 Taowei
- 8 Taowei
- 9 Taowei
- 10 Taowei
- 13 kk
This section describes the SQL automatic submission feature of SQL/PLUS learning notes. We hope this introduction will help you.