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