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

oracle 9i 创建一个存储过程,如何来做?详见帖子内容.
create or replace procedure UpdateDemarcateFileIsActive
 declarations IDNum in varchar2,
 declarations Name in varchar2
 as
 begin
 update demarcatefile set isactive='0' where name=Name
 update demarcatefile set isactive='1' where id=IDNum
 end;
 警告:创建的存储过程带有编译错误.
该存储过程该怎么写呢?
还有执行的时候该怎么执行?
还请各位同仁多多指教.非常感谢.

------解决方案--------------------
SQL code

CREATE OR REPLACE PROCEDURE UPDATEDEMARCATEFILEISACTIVE(NAMEX IN VARCHAR2,
                                                        IDNUM     IN VARCHAR2) IS
BEGIN
  UPDATE DEMARCATEFILE SET ISACTIVE = '0' WHERE NAME = NAMEX;
  UPDATE DEMARCATEFILE SET ISACTIVE = '1' WHERE ID = IDNUM;
END;
/

调用方法:
BEGIN
  UPDATEDEMARCATEFILEISACTIVE('abc', '123');
END;
/

------解决方案--------------------
Why not commit it? try it .. 

SQL code

create or replace procedure UpdateDemarcateFileIsActive 
(IDNum in varchar2, 
Name_in in varchar2)
as 
begin 
update demarcatefile set isactive='0' where name=Name_in; 
update demarcatefile set isactive='1' where id=IDNum;

commit;
end;

------解决方案--------------------
不知道你写这个declarations是干什么用的..
改成下面看看..
SQL code
create or replace procedure UpdateDemarcateFileIsActive(IDNum in varchar2,
                                                        Name  in varchar2) is
begin
  update demarcatefile set isactive = '0' where name = Name;
  update demarcatefile set isactive = '1' where id = IDNum;
  commit;
end;
我的异常网推荐解决方案:oracle存储过程,http://www.aiyiweb.com/oracle-develop/177537.html