Create a PLSQL record type

The following example will create a PLSQL variable for a record type that consists of two attributes – id and description. The attributes aren’t restricted to standard Oracle types; you could also include user created types like the record_type in the example.

type record_type is record(id number, description varchar2(1000));
record_var record_type;

Creating a variable of this type is as simple as referring a variable as something like a varchar2

variable1 record_type;

The following example assigns values to the record.

variable1.id := 1;
variable1.description := 'this is a test description;

Leave a Reply