Programmer-Defined Record
A programmer-defined record is also called a user-defined record. It is a data structure created by the programmer to store the pieces of data of different types in a single unit. These records are user-defined. these are not predefined records in a programming language or computer system. These records are defined by the programmer according to the needs of the application. These records are mainly used in programming languages that support the composite data types like structures in C/C++, and classes in Java, Python, and C#.
# Define a programmer-defined record representing a person
class Human:
def __init__(self, name, age, address):
self.name = name
self.age = age
self.address = address
# Create an instance of the Person record
Human1 = Human("Jagan Malla", 30, "Runku Street")
# Access fields of the record
print("Name:", Human1.name)
print("Age:", Human1.age)
print("Address:", Human1.address)
In the above example, ‘Human’ is the programmer-defined record with the fields of the ‘name‘, ‘age’, and ‘address’. An instance of the ‘person1‘ record will be created with the specific values for each field. This record hides the information about the person into a single object.
PL/SQL Records
PL/SQL stands for Procedural Language/Structured Query Language. It is an extension of the Structured Query Language (SQL). SQL is used in the Oracle databases for procedural programming. The main feature of PL/SQL is it can work with the composite data types, like records. PL/SQL records can be provided the binding the data into a single unit. It consists of multiple fields and each field has its data type and its name, it defines the structure of the record. These records are declared at the package, block, or schema level. PL/SQL records are allowed to developers for groups of the data under a single name, creating a structured and manageable way to handle data within the programs.