存储过程和游标的问题

jiabao1999 2006-09-15 02:48:25
代码如下:
CREATE OR REPLACE function SFCLIENT.F_BC_KYE(sdate date,edate date) return boolean as
isok boolean;
lsh number;
posid varchar2(15);
cursor fh_cursor(posid_id VARCHAR2,starttxndate date,etarttxndate date) is
select * from t_fh_rec where txndate>to_char(trunc(starttxndate),'yyyymmdd') and txndate<to_char(trunc(etarttxndate),'yyyymmdd') and posid=posid_id order by posid,posseq
cursor bc_cursor return is
select * from t_bcb;
fh_record fh_cursor%rowtype;
bc_record bc_sursor%rowtype;
begin
open bc_cursor;
dbms_output.put_line(to_char(bc_cursor%rowcount));
loop
fetch bc_cursor into bc_record;
exit when bc_cursor%notfound;
posid:=bc_record.posid;
lsh:=bc_record.maxlsh;
isok:=true;
FOR fh_record IN fh_cursor(bc_record.posid,sdate,edate) LOOP
lsh:=lsh+1;
if lsh<>fh_record.posseq then
if isok then
insert into t_bcqq values(fh_record.rowid,'noposid',lsh+1,lsh+1,'0',fh_record.posid,'0');
isok:=false;
end if;
elseif lsh=fh_record.posseq then
if not isok then
update t_bcqq set END_POSSEQ=lsh+1 where posid=fh_record.posid;
isok:=true;
end if;
else
dbms_output.put_line('异常出错');
end if;
end LOOP;
end loop;
commit;
dbms_output.put_line('汇总完成');
close bc_cursor;
return true;
end;

执行时报:‘警告: 创建的函数带有编译错误。’
望各位大虾帮忙看看
...全文
162 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wiler 2006-09-15
  • 打赏
  • 举报
回复
在另外一帖里有答案了
jiabao1999 2006-09-15
  • 打赏
  • 举报
回复
写错个字母:“bc_record bc_sursor%rowtype;”
改成:“bc_record bc_cursor%rowtype;”
jiabao1999 2006-09-15
  • 打赏
  • 举报
回复
在线等ing

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧