PL/SQL Overview

Source: Internet
Author: User

PL/SQL provides full support for data operations in the database, fully supports SQL data types, and reduces the operation of converting data between applications and databases.


The basic unit that forms a PL/SQL program is a block. PL/SQL blocks do not have to be executed on the network each time they are executed, but are sent to Oracle as a whole set of SQL statements. When the first sentence of a program begins with declare or begin, the system automatically recognizes that it is a PL/SQL statement. When PL/SQL is running in Sqlplus, the execution of the database is committed when a slash is encountered, rather than a semicolon when it is encountered as a SQL command.


To improve the readability of the program, Oracle recommends that users define various identifiers according to the following rules:

Defining variables, using V_ as prefixes, such as v_sal,v_job, etc.

Define constants, prefixed with c_, such as C_rate

Defines a cursor, using _cursor as a suffix, such as emp_cursor

Define exceptions, using E_ as a prefix, such as E_integrity_error

When defining a PL/SQL table type, it is recommended to use _table_type as a suffix, such as Sal_table_type

When defining a PL/SQL table variable, it is recommended to use _table as a suffix, such as sal_table

When defining a PL/SQL record type, it is recommended to use _record_type as a suffix, such as Emp_record_type

When defining a PL/SQL record variable, it is recommended to use _record as a suffix, such as Emp_record


To improve the readability and performance of the program, Oracle recommends that users write code according to the following casing rules:

The SQL keyword is in uppercase format, such as SELECT, UPDATE, SET, where, and so on

PL/SQL keywords in uppercase format, such as Declare,begin,end

Data type in uppercase format, such as Int,varchar2,date

Identifiers and parameters in lowercase format, such as V_sal,c_rate

database objects and columns in lowercase format, such as Emp,sal,ename

PL/SQL Overview

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.