# Object-PL/SQL

Object-PL/SQL (Object-Procedural Language/Structured Query Language or simply O-PL/SQL) is a methodology of using the Oracle Corporation's procedural extension language for SQL and the Oracle relational database. The additional features from version 7 and other improvements, lead to one of the large-scale environment implementations of the object-oriented database paradigm.
Although PL/SQL's general syntax formerly used to resemble that of Ada or Pascal, there were many improvements that mainly include the Java embedding code and the object-oriented syntax inside the SQL.
The mixing and embedding of triggers and stored procedures was one of the breakthrough points up to support the use of PL/SQL in a OO paradigm. The inclusion in the SQL syntax of statements such as [class].[object], and the implementation of the object type (like any OO language), completed the minimum requisites to a mapping approach in an extended SQL language without use of specific mapping software.

## Autonomy, notoriety and importance of O-PL/SQL

The O-PSL/SQL isn't simply the use a version of a programming language but it's identified as how to use it, and it defines the autonomy of the theme. Each version of PL/SQL, starting from 7, brings so many innovations that it's impossible to treat such usages as sub-themes of PL/SQL. So big is that revolution that it establishes a real borderline between the language, that can be used as formerly, and the OO approach inside itself. It's just this approach that makes the theme important and the large-scale using has brought its notoriety.

## A confusing of objects

There can be confusion of the notions of object of DBMS and of class object. This is very important as we live with both significances in one language. It's necessary to identify when the documentation refers to an object as one of the two definitions.
Database objects are concepts that refer to relational or sequential databases and persist being valid in new models. Tables, triggers, columns, indexes are examples of database objects, which are present in O-PL/SQL, but with the same meaning of the notion of Java objects, specifically an element of a set that has its existence beginning from an instantiation of a class.

## The PL/SQL

PL/SQL is the extended SQL language used by Oracle Database.
PL/SQL is available in Oracle Database (since version 7), TimesTen in-memory database (since version 11.2.1), and IBM Db2 (since version 9.7).
O-PL/SQL allows the definition of classes and instantiating these as objects, thus creating user-defined datatypes as writing constructors, beyond using Java in stored procedures and triggers.

## Examples of uses of syntax of O-PL/SQL

Here is a small set of examples of O-PL/SQL syntax, extracted from the official documentation and other sources:
A simple example of object-oriented PL/SQL
Now, the type's implementation is created. The implementation defines how the type's functions, procedures and how explicit constructors behave:
We're ready to derive from base_type. The keyword for deriving is under. The derived type defines a new attribute (named: m) and overrides func.
As is the case with base types, the overridden methods in the derived type must be implemented:
The created types can be instantiated and methods can be called:
Results
The created types have become real types and can be used in tables:
Results:
Result: