起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 193|回复: 5

【结贴】调用存储过程没找到参数

[复制链接]
发表于 2009-9-2 09:31:03 | 显示全部楼层 |阅读模式
你好!请问我用代码创建调用存储过程,总是报[Parameter '@as_BATCHID' not found]


我的存储过程是:
create or replace procedure clnslc(as_BATCHID in string,
                                   as_msg     out string,
                                   as_lcbh    out string) is
  t_num integer;
begin
as_msg := '';
  for rec in (select * from oa_cardregsub a where a.batchid = as_BATCHID) loop
    begin
      select count(1)
        into t_num
        from oa_cardregsub
       where oa_cardregsub.pzhm = rec.pzhm
         and oa_cardregsub.nsbz not in ('0', '3');
      if t_num > 0 then
        begin
          as_msg := '对不起,[' || rec.pzhm || ']已经提交年审,不能进行其他变更操作!';
          as_lcbh   := rec.regcardid;
        end;
      end if;
    end;
  end loop;
end clnslc;




调用的代码:
var
as_BATCHID,as_msg,as_lcbh:string;
storedproc :TStoredProc;
begin
  inherited; storedproc.ConnectionString :='DATABASEURL=Biz:\OAXT\OACCGCBSJK.Database';
     storedproc.StoredProcName :='CLNSLC';
    storedproc.Params.ParamByName('@as_BATCHID').AsString :=as_BATCHID;
  //   vProc.Params.ParamByName('@DepId').AsString := vDepId;

     storedproc.Execute;
     as_msg:=storedproc.params[1].AsString;
     as_lcbh:=storedproc.params[2].AsString;
  finally
         storedproc.Free;
  end;
  if as_msg <>'' then
  begin
       Command.Accept:=false;
       jsdialogs.ShowMsg(as_msg,'重要提示');
     end;
end;
回复

使用道具 举报

发表于 2009-9-2 09:34:26 | 显示全部楼层
你是oracle数据库吧?参数是不带@的吧。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-9-2 09:35:28 | 显示全部楼层
去掉参数@也是一样的
回复 支持 反对

使用道具 举报

发表于 2009-9-2 09:39:31 | 显示全部楼层
你先测试下,在一个窗体上放一个 storedproc,设置ConnectionString、 StoredProcName,这时候Params应该可以自动解析出来。参数名应该不带@才对吧
回复 支持 反对

使用道具 举报

发表于 2009-9-2 09:40:12 | 显示全部楼层
怎么没有发现:
storedproc :=TStoredProc.Create的代码?
去掉“@”试试
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-9-2 09:46:37 | 显示全部楼层
可以了  谢谢了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-16 22:10 , Processed in 0.043041 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表