SQL>
SQL> CREATE OR REPLACE PACKAGE outputPackage
2 IS
3 PROCEDURE printLine (val IN VARCHAR2);
4
5 PROCEDURE printLine (val IN DATE);
6
7 PROCEDURE printLine (val IN NUMBER);
8
9 PROCEDURE printLine (val IN BOOLEAN);
10 END outputPackage;
11 /
Package created.
SQL>
SQL> CREATE OR REPLACE PACKAGE BODY outputPackage
2 IS
3 PROCEDURE printLine (val IN DATE) IS
4 BEGIN
5 printLine (TO_CHAR (val, 'MM/DD/YYYY HH24:MI:SS'));
6 END;
7
8 PROCEDURE printLine (val IN NUMBER) IS
9 BEGIN
10 printLine (TO_CHAR (val));
11 END;
12
13 PROCEDURE printLine (val IN BOOLEAN) IS
14 BEGIN
15 IF val
16 THEN
17 printLine ('TRUE');
18 ELSIF NOT val
19 THEN
20 printLine ('FALSE');
21 ELSE
22 printLine ('');
23 END IF;
24 END;
25
26 PROCEDURE printLine (val IN VARCHAR2)
27 IS
28 BEGIN
29 IF LENGTH (val) > 80
30 THEN
31 DBMS_OUTPUT.put_line (SUBSTR (val, 1, 80));
32 printLine (SUBSTR (val, 81));
33 ELSE
34 DBMS_OUTPUT.put_line (val);
35 END IF;
36 EXCEPTION
37 WHEN OTHERS
38 THEN
39 DBMS_OUTPUT.enable (1000000);
40 printLine (val);
41 END;
42 END outputPackage;
43 /
Package body created.
|