SQL>
SQL> DECLARE
2 boolean_true BOOLEAN := TRUE;
3 boolean_false BOOLEAN := FALSE;
4 boolean_null BOOLEAN;
5
6 FUNCTION boolean_to_varchar2 (flag IN BOOLEAN) RETURN VARCHAR2 IS
7 BEGIN
8 RETURN
9 CASE flag
10 WHEN TRUE THEN 'True'
11 WHEN FALSE THEN 'False'
12 ELSE 'NULL' END;
13 END;
14
15 BEGIN
16 DBMS_OUTPUT.PUT_LINE(boolean_to_varchar2(boolean_true));
17 DBMS_OUTPUT.PUT_LINE(boolean_to_varchar2(boolean_false));
18 DBMS_OUTPUT.PUT_LINE(boolean_to_varchar2(boolean_null));
19 END;
20 /
PL/SQL procedure successfully completed.
SQL>
|