SQL>
SQL> create or replace function f_isSunday (in_dt DATE)
2 return VARCHAR2
3 is
4 v_out VARCHAR2(10);
5 v_flag_b BOOLEAN;
6 begin
7 v_flag_b := to_char(in_dt,'d')=1;
8 if v_flag_b then
9 v_out:='Y';
10 DBMS_OUTPUT.put_line('IsSunday=Y');
11 end if;
12 return v_out;
13 end;
14 /
Function created.