PLSQL data types and operators
PL/SQL data types and operators
Scalar Data Type
Scalar data types have no internal components. They can be divided into the following four categories:
. Number
. Character
. Date/time
. Boolean
Table 1 shows the numeric data type, table 2 shows the character data type, and table 3 shows the date and boolean data types.
Table 1 Scalar Types: Numeric
NUMBER numeric type can store integer and real value, and can define precision and value range
The BINARY_INTEGER numeric type can store signed integers to optimize integer computing performance.
Decimal NUMBER subtype
Double precision numeric NUMBER subtype, high PRECISION real NUMBER
The subtype of an integer number.
The subtype of the INT numeric NUMBER. It is an integer.
The subtype of the numeric number, which is equivalent to the NUMBER.
Subtype of real number, which is equivalent to NUMBER
The subtype of the SMALLINT numeric NUMBER. The value range is smaller than INTEGER.
VARCHAR2 character type stores variable-length strings with maximum length
Table 2-character data type
CHAR character string with Fixed Length
LONG string with a length up to 32,767 characters
DATE type stores DATE values in the same database format
BOOLEAN TRUE OR FALSE
ROWID: row number for storing the database
Table 3 DATE and BOOLEAN
LOB Data Type
LOB (Large object, Large object) data types are used to store Large data objects such as images and sounds. LOB data objects can be binary data or character data, the maximum length cannot exceed 4 GB. The LOB data type supports any access method, and LONG only supports sequential access. LOB is stored in a separate location, and a "LOB locator" (LOB locator) is stored in the original table. This locator is a pointer to the actual data. To operate LOB Data Objects in PL/SQL, use the provided package DBMS_LOB.LOB data type, which can be divided into the following four types:
. BFILE
. BLOB
. CLOB
. NCLOB
Operator
Like other programming languages, PL/SQL has a series of operators. Operators are divided into the following types:
. Arithmetic Operator
. Relational operators
. Comparison operator
. Logical operators
Arithmetic Operators are shown in table 4.
Relational operators are mainly used for condition judgment statements or for where substrings. Relational operators check whether the conditions and results are true or false. Table 5 is the Relational operators in PL/SQL.
Table 6 displays comparison operators.
Table 7.8 displays logical operators.