SQL>
SQL> CREATE OR REPLACE PACKAGE myPackage
2 IS
3 TYPE myRec IS RECORD (
4 start_date DATE,
5 trial_cost NUMBER,
6 section_id VARCHAR2(100)
7 );
8 FUNCTION critical_info RETURN myRec;
9 END;
10 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY myPackage
2 IS
3 thirty_days CONSTANT INTEGER := 30 * 24 * 60 * 60;
4 FUNCTION critical_info RETURN myRec
5 IS
6 stat PLS_INTEGER;
7 retval myRec;
8 BEGIN
9 stat := DBMS_PIPE.RECEIVE_MESSAGE ('impeachment', timeout => thirty_days);
10 IF stat = 0
11 THEN
12 DBMS_PIPE.UNPACK_MESSAGE (retval.start_date);
13 DBMS_PIPE.UNPACK_MESSAGE (retval.trial_cost);
14 DBMS_PIPE.UNPACK_MESSAGE (retval.section_id);
15 END IF;
16 RETURN retval;
17 END;
18 END;
19 /