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;
时间: 2024-10-02 23:52:51