Business days


As we all know (hopefully), we should always deploy named program units (procedures/functions) within packages. However, not many developers are aware that its not just procedures and functions that can have a public (package spec) and private (package body) component. Cursors can also be defined in the same way as the following example shows:

CREATE PACKAGE my_pkg AS
   CURSOR c1 RETURN emp%ROWTYPE;
   ...
END emp_stuff;

CREATE PACKAGE BODY my_pkg AS
   CURSOR c1 RETURN emp%ROWTYPE IS
      SELECT * FROM emp 
      WHERE hiredate < sysdate;
   ...
END emp_stuff;