Oracle存储过程简单实例

转自 http://www.cnblogs.com/nicholas_f/articles/1526029.html

/*不带任何参数存储过程(输出系统日期)*/
create or replace procedure output_date is
begin
dbms_output.put_line(sysdate);
end output_date;

/*带参数in和out的存储过程*/
create or replace procedure get_username(v_id in number,v_username out varchar2)
as
begin
  select username into v_username from tab_user where id = v_id; --变量赋值
exception
when no_data_found then
raise_application_error(-20001,'ID不存在!');
end get_username;

posted @ 2013-08-22 21:38  princessd8251  阅读(225)  评论(0编辑  收藏  举报