欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

ORACLE数据库存储过程小demo分享

程序员文章站 2022-05-07 16:37:50
oracle存储过程小demo create or replace procedure test1( p in varchar2, blood_type_name out varcha...

oracle存储过程小demo

create or replace 
procedure  test1(
p in varchar2,
blood_type_name out varchar2,
blood_type_remark out varchar2
) as
 begin
  begin
    select "blood_type_name","blood_type_remark" into blood_type_name ,blood_type_remark from "his_blood_type_config" where "id"=p;
  exception
    when no_data_found then
      blood_type_name := null;
    when too_many_rows then
      raise_application_error(-20000,'找到多条数据');
  end;
 return;

end;

打印返回错误:

dbms_output.put_line('程序运行错误!请使用游标');