PL/SQL Basic structure
PL/SQL data type Numeric type: Number (p,s), Pls_integer, Binary_integer
Character types: CHAR, NCHAR, VARCHAR2, NVARCHAR2, LONG
Day Type: Date
Boolean Type: Boolean
Define data type: type
Type < data type name > is < data type >;
Data type: Oracle allows you to define Recode, TABLE
PL/SQL Constants and variables< constant name > constant < constant type >: = < value >;
< variable name >< data type >[(width):=< initial value >];
variable is initialized to null
PL/SQL Statement control Structure NULL: The judgment statement executes when the expression is true, Null/false does not execute
IF:
Case:
Loop structure:
LOOP ... EXIT ... END
LOOP ... EXIT when ... END
While ... LOOP ... END
For ... In ... LOOP ... END
Goto:
PL/SQL Expressions:
PL/SQL cursors: Displaying cursors: Declaring cursors, opening cursors, extracting cursors, closing cursors
Example:
Implicit cursors: no definition, only one row of records
Cursor Properties:
An implicit cursor with a cursor named SQL
%isopen: Whether the cursor is open
%found: Whether the current cursor points to a valid row (%notfound)
%rowcount: Number of cursor rows
Parameterized cursors: parameters are defined with the cursor, when the cursor is used, the parameters are different, the selected rows of data are different. Cursor variables are not read
Process creation:
Call Procedure:
EXECUTE Procedure name (input parameter)
Delete procedure:
DROP PROCEDURE Procedure Name
Way:
In: Input parameters
Out: Parameters that are assigned during the process
In out: parameters that are entered and assigned in the process
Function:
Package: Baotou + package Body
Triggers: Example:
Trigger event: Before, after
4. Oracle PL/SQL language and programming