Oracle® Database PL/SQL Language Reference 11g Release 2 (11.2) Part Number E10472-02 |
|
|
View PDF |
The %TYPE
attribute lets you declare a constant, variable, array element, record field, or subprogram parameter to be of the same data type a previously declared variable, field, record, nested table, or database column. The item declared with %TYPE
is the referencing item, and the previously declared item is the referenced item.
The referencing item inherits the following from the referenced item:
Data type
Constraints (unless the referenced item is a database column)
The referencing item does not inherit the initial value of the referenced item.
If the declaration of the referenced item changes, the declaration of the referencing item changes accordingly.
Topics:
Syntax
%type_attribute ::=
Semantics
collection_name
The name of a collection.
column_name
The name of a column of a database table.
cursor_variable_name
The name of a cursor variable. Only the value of another cursor variable can be assigned to a cursor variable.
db_table_name
The name of a database table that is accessible when the declaration is elaborated.
field_name
The name of a record field.
object_name
The name of an instance of an ADT.
record_name
The name of a record.
variable_name
The name of a variable.
Examples
Example 2-13, "Declaring Variable of Same Type as Database Column"
Example 2-14, "Declaring Variable of Same Type as Another Variable"
Example 5-5, "Declaring a Procedure Parameter as a Nested Table"
Example 5-7, "Specifying Collection Element Types with %TYPE and %ROWTYPE"
Related Topics
In this chapter:
In other chapters: