Oracle存储过程简单实例

2014-11-24 17:53:55 · 作者: · 浏览: 1

  /*不带任何参数存储过程(输出系统日期)*/


  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;