Object type in pl/sql, PL-SQL Programming

Assignment Help:

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


Related Discussions:- Object type in pl/sql

Long and long raw in pl/sql, LONG and LONG RAW You use the LONG datatyp...

LONG and LONG RAW You use the LONG datatype to store the variable-length character strings. The LONG datatype is such as the VARCHAR2 datatype, except that the maximum length o

Defining ref cursor types, Defining REF CURSOR Types To make cursor va...

Defining REF CURSOR Types To make cursor variables, you take 2 steps. At first, you define a REF CURSOR type, and then declare the cursor variables of that type. You can defin

Parameter aliasing, Parameter Aliasing   To optimize the subprogram ca...

Parameter Aliasing   To optimize the subprogram call, the PL/SQL compiler can decide between the two techniques of the parameter passing. With the by-value techniques, the v

Keyword & parameter description - exceptions, Keyword & Parameter Descripti...

Keyword & Parameter Description: WHEN: This keyword introduces the exception handler. You can have many exceptions execute the similar sequence of the statements by follo

Declarations in sql-pl/sql, Declarations in SQL Your program stores value...

Declarations in SQL Your program stores values in the variables and constants. As the program executes, the value of the variables can change, but the values constants cannot.

Parameter and keyword description - object types, Parameter and Keyword Des...

Parameter and Keyword Description: type_name: This identifies a user-defined type specifier that is used in the subsequent declarations of the objects. AUTHID Clause:

Execute privilege, EXECUTE Privilege To call an invoker-rights routine ...

EXECUTE Privilege To call an invoker-rights routine straightforwardly, the users should have the EXECUTE privilege on that routine. By yielding the privilege, you permit a user

Use of table comparisons - sql, Use of Table Comparisons - SQL Table ...

Use of Table Comparisons - SQL Table comparisons where it is noted that although table expressions cannot be compared, we have TABLE (t) to convert a table expression t into

Varrays versus nested tables, Varrays versus Nested Tables The Nested ta...

Varrays versus Nested Tables The Nested tables are differing from varrays in the following ways: 1)  Varrays have a maximum size, while nested tables do not. 2)  Varrays are

Calculate the total shopper spending, Many of the reports generated from th...

Many of the reports generated from the system calculate the total dollars in purchases for a shopper. Complete the following steps to create a function named TOT_PURCH_SF that acce

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd