Composite Datatypes   «Prev  Next»

Composite Types Used In PL/SQL

Using composite datatypes within PL/SQL

The correct composite datatypes for the scenarios are:
  1. Need to store 10 product names: Use PL/SQL table
  2. Need to store name , sale_price , current_inventory_count for a single product: Use PL/SQL record
  3. Need to store product_name , but the size of the column in the database is unknown: Use %TYPE
  4. Need to store the details of all the columns within the PRODUCT table: Use %ROWTYPE

PL/SQL composite data types

Composite types have internal components that can be manipulated individually, such as the elements of an array, record, or table. Oracle TimesTen In-Memory Database supports the following composite data types:
  1. Associative array (index-by table)
  2. Nested table
  3. Varray
  4. Record
Associative arrays, nested tables, and varrays are also referred to as collections. The following sections discuss the use of composite data types:
  1. Using collections in PL/SQL
  2. Using records in PL/SQL
  3. Using associative arrays from applications

Composite Variables

A composite variable has internal components, which you can access individually. You can pass entire composite variables to subprograms as parameters. PL/SQL has two kinds of composite variables, collections and records