1. Basic data types
Number Type
int integer type
Pls_integer integer type, error occurred while generating overflow
Binary_integer integer that represents the signed integer
Char fixed-length, 255 characters maximum
Varchar2 variable length character, max 2000 characters
Long variable length character, up to 2GB
Date type
Boolean Boolean (TRUE, FALSE, null three take one)
The data types used in PL/SQL and the data types used in the Oracle database are identical in meaning and have different meanings.
2. Basic data type variable definition method
variable name type identifier [not null]:= value;
declare
Age Number (3): = 26;--Length 3, The initial value is 26
begin
commit;
end;
The syntax format for defining constants:
constant Name constant type identifier [not null]:= value;
declare
PI constant Number (9): =3.1415926;--is a numeric constant of pi, length is 9, initial value is 3.1415926
begin
commit;
end;
Variable declarations in PL/SQL
All variables must be declared in declare, and declarations are not allowed in the program.
The default value of a variable that is not initialized is null, and on-screen null is invisible, naming the habit: A variable in PL/SQL typically begins with v_ (the equivalent of a variable defined by the AS and begin regions in a stored procedure).
Note that number can also be stored in decimals, up to 38 bits, so it is recommended that integers be saved with Binary_integer.
Long is a character type and the Boolean type cannot print.
Standard variable type: number, character, time, Boolean.
PL/SQL BASIC structure---basic data type variables