Oracle -- plsql Composite data type

Source: Internet
Author: User
Oracle -- plsql Composite data type. Composite composite variables are also called composite variables. Composite variables include multiple internal components, and each component can store values separately.

Oracle -- plsql Composite data type. Composite composite variables are also called composite variables. Composite variables include multiple internal components, and each component can store values separately.

Composite variable is also called composite variable. Composite variables include multiple internal components, each of which can store values separately,
Therefore, a composite variable can store multiple values.
The composite variable type is not an existing data type in the database. Therefore, before declaring a composite variable type, you must first create a composite type,

The composite type can be used multiple times after being created to define multiple composite variables.

Composite data types include:

-Record

-Table

-Nested table

-Array

A record is a logical unit composed of a set of related data items. Each data item has its own name and data type.

A table is a collection of data that can be referenced and processed as a whole.

A table consists of columns and keywords, where rows can be accessed in groups using keywords.

Once defined, record and table can be reused.

PL/SQLRecord

A record is a set of related data items stored in multiple fields. Each field has its own name and data type.
Regard the set of fields as a whole logical unit
It is mainly used to retrieve the queried row data from the table.

Record features:

Each record can contain many fields.
You can assign an initial value to the record, and use not null to limit the record.
A field without an initial value is defined as NULL. You can also use the reserved word DEFAULT when defining a field.
You can define the RECORD type in the declaration part of any block, subroutine, or package and declare custom records.
You can declare and reference nested records. A record can be a component of other records.

Syntax:

  • TYPE type_name IS RECORD
  • (Field_declaration [, field_declaration]…);
  • Field_declaration:

  • Field_name {field_type | variable % TYPE
  • | Table. column % TYPE | table % ROWTYPE}
  • [[Not null] {: = | DEFAULT} expr]

  • TYPE emp_record_type IS RECORD
  • (Empno emp. empno % type,
  • Ename emp. ename % type,
  • Job varchar2 (9 ));
  • Emp_record emp_record_type;
  • 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.