Basic block format and syntax for PL/SQL Learning notes

Source: Internet
Author: User

One: PL/SQL program block

PL/SQL is a block-structured language, and a PL/SQL program is a code logic block.

The PL/SQL program consists of three components:

1 Declarations Section
Starting with the keyword DECLARE , it is an optional part that declares all variables, cursors, subroutines, and other elements that are used in the program with the assigned initial value .
2 Executable Commands Section
Use the keyword begin and end packages , must have. Defines a series of PL/SQL statements .
3 Exception Handling Section
Use the keyword EXCEPTION, Optional, to handle exceptions captured by the executable commands section .

Two: Basic format

DECLARE    <declarations section>BEGIN   <executable command (s) >EXCEPTION   <exception Handling>END;

Three: Notes

Single-line comment: Use separators--。

Multiline Comments:/* and */.

Four: operational symbols

+, -, *, / addition, subtraction/negation, multiplication, division
% Property Index
String
. Dot operator
(,) An expression or list separator
: Host variable Indicator
, Item Separator
" Quoted identifier delimiter
= Relational operators
@ Remote Access Indicator
; Declaration Terminator, Statement Terminator
:= Assignment operators
= Operator Association
|| Connection operators, string connections
** Exponentiation operator
<<, >> Label delimiter (start and end)
/*, */ Multiline comment delimiter (start and end)
-- Single-line Comment indicator
.. Range operations
<, <=, >= Relational operators
<>, ' =, ~=, ^= Unequal operators

Five: Program unit

PL/SQL Program unit: A named PL/SQL block in a database that is stored as a database object in a database.

There are five main categories:

PL/SQL Block: A block of program code that carries out some action, including the three blocks mentioned above (where declarations, exceptions are optional).

Procedure: Performs a specific operation with no return value.

Function: A complex calculation with a return value.

Package: Logically related procedures and functions are organized together, analogous to classes in Java.

Trigger: Event trigger, perform the appropriate action.

Basic block format and syntax for PL/SQL Learning notes

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.