当前位置: 代码迷 >> Oracle开发 >> 不包含参数的存储过程应该怎么建立
  详细解决方案

不包含参数的存储过程应该怎么建立

热度:111   发布时间:2016-04-24 07:53:26.0
不包含参数的存储过程应该如何建立?

create   or   replace   package   Pac_Test
as
    procedure   Pro_DelAndUpd();
end   Pac_test;
/
Commit;
/

create   or   replace   package   body   Pac_Test
as
              procedure   Pro_DelAndUpd
              is
              begin
                        update   t_test   set   name   =   name   ||   '   is   updated ';
delete   from   t_test   where   id   =   1001;
dbms_lock.sleep(1);
RAISE_APPLICATION_ERROR(-1, '大哥,出错了! ');
              end   Pro_DelAndUpd;
end   Pac_Test;
/
Commit;
/

----------------------------

显示错误:

3/32           PLS-00103:   出现符号   ") "在需要下列之一时:
                  <an   identifier>
                  <a   double-quoted   delimited-identifier> current


------解决方案--------------------
改了一下:


create or replace package Pac_Test
as
procedure Pro_DelAndUpd;
end Pac_test;


create or replace package body Pac_Test
as
procedure Pro_DelAndUpd
is
begin
update t_test set name = name || ' is updated ';
delete from t_test where id = 1001;
dbms_lock.sleep(1);
RAISE_APPLICATION_ERROR(-1, '大哥,出错了! ');
end Pro_DelAndUpd;
end Pac_Test;
  相关解决方案