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;