Getting started with sqlplus

Source: Internet
Author: User

1. Logon: 1. sqlplus enter the user password as prompted, but there is no place to enter the database connection string. You need to set ORACLE_SID in advance. 2. sqlplus user/pass @ db log on directly. The disadvantage is that the password may be exposed in a multi-user system. 3. sqlplus/nolog connect user/pass @ db first without logging on, just start sqlplus and connect to the database. The password will not be exposed compared with method 2. Q: What is the difference between "user/pass @ db" and "no package" when logging on? A: The unwrapped mode is only supported after oracle10g. Www.2cto.com 2. Execution: 1. A slash (/) indicates that the statement in the buffer (just entered) must be executed in a separate line. There must be no space before/before oracle9i. 2. EXEC [UTE] stored procedures: execute stored procedures (including functions and packages) in the database ). 3. START | @ script file: Execute the script file. If the script does not have an extension, the. SQL file is automatically added. If no path exists, it is the current directory by default, or you can find it from the SQLPATH parameter. 4. The @ script file is generally used in the script file. Like @, the script file is executed, but the current directory is the directory of the script where @ is called. 3. EDIT: 1. EDIT the file name. Start the editor. If no parameters are available, EDIT the statements in the buffer. The buffer only keeps the last statement executed. The following commands are used to enter the EDIT Editor: 2. List the edited statements. 3. n indicates the nth row as the current row. 4. Delete the current row by del. 5. Replace "c/old/new/" with "old" in the current row as "new", "/" as a separator, or "yes! 6. n text uses text as the nth line. 7. Insert a row after the current row I. 8. Add a text character at the end of the current line. 4. Error: processing when an error occurs in the execution script. The execution continues by default. If an error is required, add whenever sqlerror exit SQL. SQLCODE, or whenever sqlerror SQL. sqlcode exit rollback. 5. variables: 1. DEFINE x = "hello"; Use & x reference, which is only valid on the sqlplus end. When SQL or plsql is submitted, the value is replaced and then submitted. Www.2cto.com 2, VARIABLE x varchar2 (10); defines a plsql binding VARIABLE and passes it to the database server as a parameter. 6. Common Format: set serverouput on: Display plsql output set echo on: display the executed statement set feedback on: display the number of records of the query results set heading on: set linesize 80: a maximum of 80 characters in each row set pagesize 24: a maximum of 24 rows per page set timing on: Display execution time set autotrace on: show Execution Plan set sqlblankline on: allow execution script to have empty rows set column dept format a15 heading 'department ': set the column dept to display 15 characters in width, and the column header is departmentset define off: do not check the special characters in the script, such as the & Symbol. The input parameter flag is used by default. Author hulubo

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.