日期:2014-05-16  浏览次数:20842 次

存储过程出错了,帮看看是什么原因
刚接触存储过程,试着写了一个。

运行的时候说:
Warning: 执行完毕, 但带有警告
PROCEDURE SP_INSERT_XQ 已编译。

用exec PROCEDURE SP_INSERT_XQ('','');运行的时候,出错了。

下面是我写的存储过程,大家帮看看。


create or replace PROCEDURE SP_INSERT_XQ
(
   xqmc in VARCHAR2(30),
   ssqh in VARCHAR2(12)

AS
  str_xqbm NUMBER;
  jls NUMBER;
  str_tmp VARCHAR2(2);
begin
  select count(*) INTO jls from qh where sjqhbm=ssqh and substr(qhbm, 13, 2) <> '99' and qhjb=''6'
  if(jls=0)  then
   insert into qh(qhbm,qhmc,sjqhbm,tbrq) values(ssqh+'01',xqmc,ssqh,SYSDATE);
  else 
   select max(qhbm) into str_xqbm from qh where sjqhbm=ssqh and substr(qhbm, 13, 2) <> '99' and  substr(qhbm, 13, 2) <> '98' an qhjb='6';
   str_tmp := to_char(substr(str_xqbm,13,14))+1);
   if length(str_tmp)=1 then
   str_tmp :='0' +str_tmp;
   end if;
   insert into qh(qhbm,qhmc,sjqhbm,tbrq) values(ssqh+str_tmp,xqmc,ssqh,SYSDATE);
end if;
END SP_INSERT_XQ

------解决方案--------------------
所有拼接字符串的+改成
------解决方案--------------------
在PLSQL中选中存储过程,右键,选调试,然后按F9进入单步调试。