SQL/PLUS learning notes: Automatic SQL submission

Source: Internet
Author: User

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:

 
 
  1. SQL> show auto  
  2.  
  3. autocommit OFF  
  4.  
  5. SQL> set auto on  
  6.  
  7. 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.

 
 
  1. SQL> define
  2. DEFINE _ DATE = "14-8-11" (CHAR)
  3. DEFINE _ CONNECT_IDENTIFIER = "orcl" (CHAR)
  4. DEFINE _ USER = "EMC" (CHAR)
  5. DEFINE _ PRIVILEGE = "" (CHAR)
  6. DEFINE _ SQLPLUS_RELEASE = "1002000100" (CHAR)
  7. DEFINE _ EDITOR = "Notepad" (CHAR)
  8. DEFINE _ O_VERSION = "Oracle Database 10g Enterprise Edition Release 10.2.0.
  9. 1.0-Production
  10. With the Partitioning, OLAP and Data Mining options "(CHAR)
  11. 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:

 
 
  1. 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;
  2. SQL> $
  3. Microsoft Windows XP [version 5.1.2600]
  4. (C) Copyright 1985-2001 Microsoft Corp.
  5. C: \ Documents ents and Settings \ hawk> dir
  6. The volume in drive C is C
  7. The serial number of the volume is 4D28-FE45
  8. C: \ Documents ents and Settings \ hawk directory
  9. <DIR>.
  10. <DIR> ..
  11. <DIR> Start Menu
  12. <DIR> My Documents
  13. <DIR> Favorites
  14. <DIR> Desktop
  15. <DIR>. myeclipse
  16. <DIR>. m2
  17. 128. myeclipse. properties
  18. MagicEmotions. idx
  19. 25. pulse2.locator
  20. <DIR> EurekaLog
  21. 225,685 sqlnet. log
  22. <DIR> workspace
  23. 89 afiedt. buf
  24. <DIR> Tracing
  25. File. SQL -- enter select * from t_1 in it; then save
  26. 6 files in 225,953 bytes
  27. 8,195,407,872 available bytes in 11 Directories
  28. C: \ Documents ents and Settings \ hawk> exit -- enter the exit command to return to sqlplus
  29. SQL> @ file -- run the script. The execution result is shown below. The input @ file or start file is the same.
  30. ID NAME
  31. ------------------------
  32. 1 Taowei
  33. 2 Taowei
  34. 3 Taowei
  35. 4 Taowei
  36. 5 Taowei
  37. 6 Taowei
  38. 7 Taowei
  39. 8 Taowei
  40. 9 Taowei
  41. 10 Taowei
  42. 13 kk

This section describes the SQL automatic submission feature of SQL/PLUS learning notes. We hope this introduction will help you.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.