Oracle System Toolkit (learning notes)

Source: Internet
Author: User

Dbms_output Bag

No.

Sub-Program Name

Describe

1

Enable

Opens the buffer when the user uses the

"SET serveroutput on" command, this statement is called automatically

2

Disable

Closes the buffer when the user uses the

"SET serveroutput OFF" command, this statement is called automatically

3

Put

Saves content to a buffer, does not contain newline characters, and so on when executing put_line output

4

Put_Line

Direct output of specified content, including line breaks

5

New_line

Add newline characters at the end of a line, and you must rely on New_line to add newline characters when using put

6

Get_line

Gets the single-line information in the buffer

subroutine definition:"procedure Get_line (line out varchar2, status out Integer);"

parameter function: line: The row retrieved by Get_line;

Status: Whether to retrieve a row, if set to 1 for retrieving a row, if 0 means that no data is retrieved.

7

Get_lines

Gets all the information in the buffer as an array

subroutine definition:"procedure get_lines (lines out Chararr, numlines in Out integer);"

Parameter function:

Line: The row retrieved by Get_line is a Chararr type, which is a nested table of VARCHAR2 (255),

Returns the multi-line information of the buffer;

Status: Whether to retrieve a row, if set to 1 to retrieve a row, if 0 means that no data retrieval;

Numlines: If the number of rows to return is indicated as an input parameter, the number of rows actually fetched as a return parameter.

Example One, Set output open, enable and close disable

BEGIN   dbms_output.enable;   -- Enable buffering  Dbms_output.put_line (' can be displayed '); END;
BEGIN   dbms_output.disable;   -- Enable buffering  Dbms_output.put_line (' cannot be displayed '); END;

example Two, Set Buffer

BEGINdbms_output.enable; --Enable bufferingDbms_output.put ('www');--adding content to the bufferDbms_output.put ('163.com');--adding content to the bufferDbms_output.new_line;--Wrap, the contents of the buffer between the outputsDbms_output.put ('www.baidu.com');--adding content to the bufferDbms_output.new_line;--Wrap, the contents of the buffer between the outputsDbms_output.put ('www.qq.com');--adding content to the bufferEND; Result: www163.comwww.baidu.com last line because there is no line break, this content does not output

example Three, Retrieving buffer data using the Get_line () and Get_lines () functions

DECLAREv_line1VARCHAR2( $); V_line2VARCHAR2( $); V_status Number;BEGINdbms_output.enable; --Enable bufferingDbms_output.put ('www.baidu.com');--adding content to the bufferDbms_output.new_line;--Wrap, the contents of the buffer between the outputsDbms_output.put ('www.qq.com');--adding content to the bufferDbms_output.new_line;--Wrap, the contents of the buffer between the outputsDbms_output.get_line (V_line1,v_status);--Read Buffer rowDbms_output.get_line (V_line2,v_status);--Read Buffer rowDbms_output.put_line (V_LINE1);--Read Buffer rowDbms_output.put_line (V_line2);--Read Buffer rowEND;-------------DECLAREV_lines Dbms_output.chararr; --Defining Charrarr VariablesV_status Number;BEGINdbms_output.enable; --Enable bufferingDbms_output.put ('www.baidu.com');--adding content to the bufferDbms_output.new_line;--Wrap, the contents of the buffer between the outputsDbms_output.put ('www.qq.com');--adding content to the bufferDbms_output.new_line;--Wrap, the contents of the buffer between the outputsDbms_output.get_lines (V_lines,v_status);--Read Buffer row      forXinch 1.. V_lines.CountLOOP Dbms_output.put_line (v_lines (x));--Read Buffer row     ENDLOOP;END;

Dbms_assert Bag
No. Sub-Program Describe
1 Enquote_literal Receives a string and adds a single quotation mark before and after the string
2
3
4
5
6
7

Example four, add single quotation marks to the front and back of the string

SELECT Dbms_assert. Enquote_literal ('www.hellojava' from dual;

Example five, double quotes before and after a string

SELECT Dbms_assert. Enquote_name ('www.hellojava' from dual;

Example six, verifying that a string is a valid mode object name

SELECT Dbms_assert. Qualified_sql_name ('hello_orcale' from dual;

Example seven, entering the wrong weapon object

SELECT Dbms_assert. Qualified_sql_name ('123' from dual; -- object name cannot start with a number

Example eight, verifying whether a string is a valid schema name

SELECT Dbms_assert. Schema_name ('SCOTT' from dual;

Require mode name all uppercase

Example nine, input error mode name

SELECT Dbms_assert. Schema_name ('tests' from dual;

Cannot lowercase mode name

Oracle System Toolkit (learning notes)

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.