Mega Code Archive
When creating selector CASE statements, you cannot have NULL in the list of possible values
Although the following code is correct from the syntax point of view, it doesn't work:
create or replace function f_getDateType (in_dt DATE)
return VARCHAR2
is
v_out VARCHAR2(10);
begin
case TO_CHAR(in_dt,'d')
when null then
-- value will be null if in_dt is null
v_out:='';
when 1 then
v_out:='SUNDAY';
when 7 then
v_out:='SATURDAY';
else
v_out:='WEEKDAY';
end case;
return v_out;
end;
/