4. OraclePL/SQL language and Programming

Source: Internet
Author: User
PLSQl basic structure PLSQL data type numeric type: NUMBER (P, S), PLS_INTEGER, BINARY_INTEGER character type: CHAR, NCHAR, VARCHAR2, NVARCHAR2, long date type: DATE boolean type: BOOLEAN defines the data type: typetype data type name is data type; Data Type: Oracle allows defining REC

PL/SQL basic structure PL/SQL data type numeric type: NUMBER (P, S), PLS_INTEGER, BINARY_INTEGER character type: CHAR, NCHAR, VARCHAR2, NVARCHAR2, LONG date type: date boolean type: BOOLEAN defines the data type: type data type name is data type; Data type: Oracle allows defining REC

Basic PL/SQL Structure
PL/SQL data type: NUMBER (P, S), PLS_INTEGER, BINARY_INTEGER
Character Types: CHAR, NCHAR, VARCHAR2, NVARCHAR2, LONG
DATE type: DATE
BOOLEAN Type: BOOLEAN
Define data type: type
Type <数据类型名> Is <数据类型> ;
Data Type: Oracle allows the definition of RECODE and TABLE

PL/SQL constants and variables <常量名> Constant <常量类型> : = <Value>;
<变量名> <数据类型> [(Width): = <初始值> ];
Variable Initialization is null

PL/SQL statement control structure NULL: the statement is executed only when the expression is true. If the expression is NULL or FALSE, the statement is not executed.
IF:
CASE:
Loop Structure:
LOOP... EXIT... END
LOOP... exit when... END
WHILE... LOOP... END
FOR... IN... LOOP... END
GOTO:

PL/SQL expressions:
PL/SQL cursor: Display cursor: declare cursor, open cursor, extract cursor, close cursor
Example:
Implicit cursor: No need to define, only one row of records
Cursor property:
Implicit cursor, whose name is SQL
% ISOPEN: whether the cursor is opened
% FOUND: whether the current cursor points to a valid row (% NOTFOUND)
% ROWCOUNT: Number of cursor rows
Parameterized cursor: includes a parameter-defined cursor. When using a cursor, the parameters are different and the selected data rows are different.

Process Creation:
Call process:
EXECUTE Process name (input parameter)
Deletion process:
Drop procedure process name
Method:
In: input parameters
Out: The parameter assigned during the process.
In out: input and assigned Parameters

Function:
Package: packet header + package body

Trigger: Example:
Trigger events: BEFORE and AFTER




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.