日期:2014-05-17  浏览次数:20894 次

不包含参数的存储过程应该如何建立?

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;