存储过程


create or replace procedure Hello is
h number;
g char(20);

begin
select extract(hour from systimestamp)+8 into h from dual;

if h >=20 or h<=5 then
     g:='Goodnight';
elsif h >12 and h <=12 then
     g:='Good morning';
elsif h >12 and h <=17 then
     g:='Good afternoon';
else
     g:='Good evening!';
end if;
dbms_output.put_line(g);
end;

  //简单的存储过程,通过获取当前小时,来返回对应的问候。