Object type in pl/sql, PL-SQL Programming

Object Type:

The object type is a user-defined composite datatype which encapsulates a data structure along with the functions and procedures required to manipulate the data. The variables which form the data structure are known as the attributes. The functions and procedures which characterize the behavior of the object type are known as methods.

We typically think of an object (like a car, person, or bank account) as having behaviors and attributes. For illustration, a baby has the attributes age, gender, and weight, and the behaviors drink, eat, and sleep. The Object types maintain this perspective when you sit down to write an application.

Whenever you define an object type using the CREATE TYPE statement, you create an abstract template for several real-world objects. The template specifies only those behaviors & attributes that the object which will require in the application atmosphere. For illustration, an employee has numerous attributes, but usually only a few are required to fill the requirements of an application.

172_Object Type in pl-sql.png

Figure: Form Follows Function

 

Assume that you should write a program to allocate the employee bonuses. Not all the employee attributes are required to solve this problem.Therefore, you design an abstract employee who has the problem-specific attributes as: name, job title, id_number, department, salary, and rank. Then, you can identify the operations required to handle an abstract employee. For illustration, you require an operation which lets Management change the rank of an employee.

Later, you define a set of variables to present the data, and a set of subprograms to perform the operations. Lastly, you encapsulate the methods and attributes in an object type. The data structure created by the set of attributes is public. Though, well-behaved programs do not influence it directly. Rather, they use the set of methods provided. In that way, the employee data is kept in an appropriate state.

At run time, if the data structure is filled with values, you have created an illustration of an abstract employee. You can create as numerous instances (usually known as objects) as you require. Each object has the name, job title, and number, and so on of an actual employee. This data is accessed or changed only by the methods related with it. Therefore, the object types let you create objects with the well-defined behavior and attributes.

2140_Object Type in pl-sql1.png

Figure: Object Type and Objects (Instances) of That Type

Posted Date: 10/6/2012 7:56:13 AM | Location : United States







Related Discussions:- Object type in pl/sql, Assignment Help, Ask Question on Object type in pl/sql, Get Answer, Expert's Help, Object type in pl/sql Discussions

Write discussion on Object type in pl/sql
Your posts are moderated
Related Questions
Ensuring Backward Compatibility   The PL/SQL Version 2 permits some abnormal behavior which Version 8 disallows. Particularly, Version 2 permits you to (i) Make the forw

Procedures The procedure is a subprogram which can take parameters and be invoked. Normally, you can use a procedure to perform an action. The procedure has 2 sections: the spe

FETCH Statement The FETCH statement retrieve rows of data one at a time from the result set of the multi-row query. The data is stored in fields or variables which correspond t

Parameter and Keyword Description:   table_reference: This identifies a table or view which should be available when you execute the INSERT statement, and for that you sho

Opening a Cursor Variable The OPEN-FOR statement relates a cursor variable with the multi-row query, executes the query, and then identifies the result set. The syntax for ope

Organi c Evolution Evolution is a slow continuous, irreversible and natural process of change to give rise to advance and diverse forms of life i.e. formation of new specie

Transactions in SQL BEGIN TRANSACTION, COMMIT, and ROLLBACK, SQL has the same syntax except for START in place of BEGIN. However, START TRANSACTION is used only for outermost

At times, Brewbean's has changed the id number for existing products. In the past, they have had to add a new product row with the new id to the BB_PRODUCT table, modify all the co

Records Records are the items of the type RECORD. The Records have exclusively named fields that can store the data values of various types. And hence, a record treat associate

Project Description: I want a small relational database to be built. I want the database to have the subsequent information tables: Employee Information Document storage