Documentation
 
 
 

16.5. Referencing a Package

To reference the types, items and subprograms that are declared within a package specification, we use the dot notation. For example:

  • package_name.type_name

  • package_name.item_name

  • package_name.subprogram_name

To invoke a function from the emp_admin package specification, we will execute the following SQL command.

SELECT emp_admin.get_dept_name(10);

Here we are invoking the get_dept_name function declared within the package emp_admin. We are passing the department number as an argument to the function, which will return the name of the department. Here the value returned should be "ACCOUNTING", which corresponds to department number 10.

This function could also be invoked as following since we have specified a default IN parameter for this function:

SELECT emp_admin.get_dept_name;

This too should return "ACCOUNTING", as we have set the default department number to 10.

 
 ©2004-2007 EnterpriseDB All Rights Reserved