create or replace function getdate(indate varchar2)
   return date
    as
     i number;
      j number;
   begin
     if indate='星期一' then
         i:=2;
      elsif indate='星期二' then
         i :=3;
     elsif indate='星期三' then
         i :=4;
     elsif indate='星期四' then
         i :=5;
     elsif indate='星期五' then
         i :=6;
     elsif indate='星期六' then
         i :=7;
     elsif indate='星期七' then
         i :=1;
     end if;
          
     select to_char(sysdate,'D') into j from dual;
     if i>j then
         return sysdate+(i-j);
     elsif i=j then
         return indate;
     else
         return sysdate+(7-j+i);
    end if;
   end;
   /
 
SQL> select getdate('星期一') from dual;