Team Fly 

Page 17

developers create their own functions to augment what is delivered with the software. Suppose one wants to strip all the vowels out of a name with a function. One passes in a name (for instance, Bellissimo) and gets back the text ''Bllssm" when the function completes its work. Let's look at the get_age function which operates based on the following logic:

given a date of birth (format DD-MON-YYYY)
using an SQL function
get the months between today's date and the date passed in
divide the number of months by 12
truncate the results (giving the span in years between the 2 dates)
pass integer back

Packages

Packages roll functions and procedures together into a cohesive programming unit. Often, developers like to bundle like functionality together since it makes logical sense to call one larger unit and have it perform a series of tasks. Let's look at the CREATE_EMPLOYEE package in Table 1-4.

Component Name

Type

Work Accomplished

give_holidays

Procedure

Creates the default holiday quota based on the new person's rank in the company.

notify_benefits

Procedure

Creates a record in the BEN_QUEUE table to alert the benefits people of the new employee.

is_under_25

Function

Returns a "1" if the new employee is under 25 years old as of December 31 of the year they were hired.

is_over_59

Function

Returns a "1" if the new employee is 60 years old or older as of the calendar date of hire.

TABLE 1-4. Members of the CREATE_EMPLOYEE Package

Team Fly 
0036