What is composite data type?

What is composite data type?

A composite data type could be a record, table, nested table, varray. This is so because all of them are composed of multiple data types. For instance, a RECORD has fields, its values etc. Each field has a name and a different data type. A RECORD can have multiple fields whose initial values can be NOT NULL.

Example :
Creating a record to store name and id of student:
TYPE student_data IS RECORD
(
First_name VARCHAR(20),
Id NUMBER(2),
);

Create a record type to hold the values declared above:
Student_record student_data;

To access a field: Student_record.id

Assign a value: Student_record.id=1

What is composite data type?

Collections are usually referred to as Composite Data types. Composite type is one that has components in it. A variable of a composite type contains one or more scalar types.
Types of composite data type
Following are the types of composite data types: RECORD – PL/SQL records are similar to C structures. A record provides with a way to deal with separate but related variables as a unit...
Oracle object datatypes
Oracle object datatypes - Object data types are user defined data types. Both column and row can represent an object type. Object types instance can be stored in the database....
Explain the constraints that can be applied to Oracle tables
The syntax of writing a table is create table tablename ( columnname type, columnname type ..., primary key(keycolumn);...
Post your comment