PL/SQL data types and operators

Source: Internet
Author: User
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.

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.