获得当前时间的PRO

时间:2024-12-14 15:02:50

1.没有参数的存储过程

create or replace procedure get_time
as
   cur_time varchar2(10);
begin
  select to_char(sysdate,'yyyymmdd') into cur_time from dual;
  dbms_output.put_line(cur_time);
end;

call get_time();

2.有输出参数的存储过程
create or replace procedure get_time(cur_time out varchar2)
as
begin
  select to_char(sysdate,'yyyymmdd') into cur_time from dual;
end;

declare
  cur_time varchar2(10);
begin
  get_time(cur_time);
  dbms_output.put_line(cur_time);
end;