Oracle PL/SQL - PL SQL Introduction Data Type

Introduction

Data type abstraction allows you to work with the data without knowing the implementation details.

You can use the following data type abstraction:

Item
Description
Cursors
A cursor is a pointer to a SQL area for specific SQL statement or PL/SQL SELECT INTO statement.
Composite Variables






A composite variable can have internal components.
PL/SQL has two kinds of composite variables, collections and records.
In a collection, the elements are always of the same data type.
You access each element by its unique index.
In a record, the element can be of different data types, and are called fields.
You access each field by its name.
A record variable can hold a table row, or some columns from a table row.
%ROWTYPE Attribute


The %ROWTYPE attribute allows you to declare a record that represents either a full or partial row from a table or view.
For every column, the record has a field with the same name and data type.
If the structure of the table or view changes, the structure of the record changes accordingly.
%TYPE Attribute
%TYPE attribute allows you to declare a structure.
Abstract Data Types



An Abstract Data Type (ADT) is like class in programming language.
It can have fields and methods.
ADTs are stored in the database.
Instances of ADTs can be stored in tables and used as PL/SQL variables.