Some other tips on Oracle's Sqlplus

Source: Internet
Author: User
Tags sqlplus

The command that executes the script is already mentioned in the previous section and is no longer duplicated.

Sqlplus User/[email protected]:p ort/servicename @/path/sqltest.sql;

Sqltest's content and notes:

--This whenever indicates that after an error occurs, it is no longer executed and will try to roll backWhenever SQLERROREXITSql. SQLCODEROLLBACK--select ' OK ' from DUABBL;--select ' OK ' from Duiaaal;--Statement of output executionSetEcho on;--output execution results to a fileSpool/Tmp/Spool.txt;Select 'OK'  fromdual;--create an empty, harmless stored procedureCreate or Replace procedureADISABLEDSP (TimeStamp  Number, TableNamevarchar2) is  begin  if TimeStamp<0  Then --This condition can never be set and the input parameters are used timestampDbms_output.put_line ('We is going to operate on table' ||TableName);--the input parameters are used tablenameEnd if; End;--this/execution is required on the command line, indicating execution, otherwise, only newline/  Select 'OK'  fromdual;Select 'OK'  fromdzual;--Dual database is commonly used for testing purposesSelect 'OK'  fromDual;spoolif;--This also must, otherwise, after the script execution completes, will hang in the Sqlplus command line, does not exitExit;

Look at a few SQL stored procedures, note that some display a row, some display the name, and some display content:

Select name from User_source where type= ' PROCEDURE ', select text from all_source where name = ' Pro_name ', select * from user _procedures;

  

The last trick, why in the script, will appear a/right slash it?????

usually in end; (note there is a semicolon) followed by a backslash/, that is, to execute a stored procedure, if there is no backslash, it is normal line break. This is typically used in command windows in Oracle.

Https://zhidao.baidu.com/question/560015241204373364.html

Some other tips on Oracle's sqlplus

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.