Data abstraction, PL-SQL Programming

Assignment Help:

Data Abstraction

The Data abstraction extracts the important properties of data while ignoring the not necessary details. Once you design a data structure, you can fail to remember the details and focus on designing algorithms that manipulate the data structure.

Collections

The collection types TABLE and VARRAY permit you to declare nested tables and variable-size arrays (varrays in short). A collection is an ordered group of elements, all of the similar type. Every element has a unique subscript that determines its place in the collection.

To reference an element, use the standard subscripting syntax. For e.g., the following call references the 5th element in the nested table returned by the function new_hires:

DECLARE

TYPE Staff IS TABLE OF Employee;

staffer Employee;

FUNCTION new_hires (hiredate DATE) RETURN Staff IS

BEGIN ... END;

BEGIN

staffer := new_hires('10-NOV-98')(5);

...

END;

The Collections work like an array found in most third-generation programming languages. The collections can also be passed as parameters. And hence, you can use them to move columns of data into and out of database tables or between the client-side applications and stored subprograms.

Records

You can use the %ROWTYPE attribute to declare a record that shows a row in a table or a row fetched from a cursor. Although, with a user-defined record, you can declare fields of your own. The Records contain exclusively named fields that can have different datatypes. Assume that you have different data about an employee like name, salary, & hire date. These items are not similar in type but logically related. Records containing a field for each item treat the data as a logical unit. Consider the example shown below:

DECLARE

TYPE TimeRec IS RECORD (hours SMALLINT, minutes SMALLINT);

TYPE MeetingTyp IS RECORD

(

date_held DATE,

duration TimeRec, -- nested record

location VARCHAR2(20),

purpose VARCHAR2(50));

Remember that you can nest the records. That is, the record can be the component of another record.


Related Discussions:- Data abstraction

Full time system administrator, Need Windows and Linux system Administrator...

Need Windows and Linux system Administrator We are seeking a part time system administrator to take care of our servers. Your things to do would add, but not limited to: -

Committing and rolling back - autonomous transaction, Committing and Rollin...

Committing and Rolling Back The COMMIT and ROLLBACK end the active autonomous transaction but do not exit the autonomous routine. As the figure shows, if one transaction ends,

Effects of null for multiple assignments - sql, Effects of NULL for Multipl...

Effects of NULL for Multiple Assignments - SQL If the row expression given as the source for a multiple assignment evaluates to NULL, then NULL is assigned to each target. If

Structure of an object type in pl/sql, Structure of an Object Type: Si...

Structure of an Object Type: Similar to package, an object type has 2 parts: the specification and the body. The specification is the interface to your applications; it declar

Example of add constraint in sql, Example of ADD CONSTRAINT in SQL Exa...

Example of ADD CONSTRAINT in SQL Example: Alternative formulation for MAX_ENROLMENTS ALTER TABLE IS_ENROLLED_ON ADD CONSTRAINT MAX_ENROLMENTS CHECK ((SELECT COUNT (*)

Rowid - sql pseudocolumns, ROWID The ROWID returns the rowid (binary a...

ROWID The ROWID returns the rowid (binary address) of a row in the database table. You can use the variables of the type UROWID to store rowids in a readable format. In the il

Autonomous versus nested transactions, Autonomous versus Nested Transaction...

Autonomous versus Nested Transactions Though an autonomous transaction is started by the other transaction, it is not a nested transaction for the reasons shown below: (i)

Triffic light control system, write the program for traffic control system ...

write the program for traffic control system with 10 second, 15 secod, and 20 second delay

Parameter default values, Parameter Default Values As the illustration ...

Parameter Default Values As the illustration below shows, you can initialize the IN parameters to the default values. In that way, you can pass various numbers of actual par

Product-specific packages, Product-specific Packages The Oracle and dif...

Product-specific Packages The Oracle and different Oracle tools are supplied with the product-specific packages which help you to build the PL/SQL-based applications. For illus

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