PB调用plsql存储过程。报错!!pl sql数字或值错误字符串缓冲区太小

liaicheng12 2013-08-13 03:05:38
目前自己写的pb程序都碰到这种问题,varchar2类型的变量,我都设置成4000size了,还是没解决。代码如下:
PROCEDURE
 function check_actionata(p_actionata defect.actionata%type,
p_actype orders.actype%type,
p_return out varchar2) return number is
l_count number;
begin
if trim(p_actionata) is null then
p_return := null;
return 1;
end if;
if trim(p_actype) is null then
select count(ata)
into l_count
from ata
where trim(ata) = trim(p_actionata)
and not_for_defect is null;
else
select count(ata)
into l_count
from ata
where trim(actype) = trim(p_actype)
and trim(ata) = trim(p_actionata)
and not_for_defect is null;
end if;
if l_count = 0 then
p_return := zh_pub_function.get_message('DEFECT', -7);
return 0;
end if;
p_return := null;
return 1;
end check_actionata;

调用函数:
if dwo.name = 'ata' then
data = trim(data)
ls_actype = trim(ls_actype)
ls_return = trim(ls_return)
sqlca.check_actionata( data, ls_actype, ls_return)
messagebox('提示',sqlca.sqlerrtext)
if trim(ls_return) <>'' then
else
messagebox('提示',ls_return)
end if
end if
...全文
2155 19 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
young_洋 2015-10-12
  • 打赏
  • 举报
回复
遇到同样问题,受教了!
heremei 2013-08-30
  • 打赏
  • 举报
回复
引用 17 楼 liaicheng12 的回复:
引用 15 楼 Herecs 的回复:
[quote=引用 13 楼 liaicheng12 的回复:] [quote=引用 12 楼 Herecs 的回复:] 看不出啥太大的问题,建议把存储过程改成程序中的方法,然后用debug调试一下。
其实这个方法也是试了,还是不行啊。pb新手,对这种问题完全误解啊。大神,求救~!
用debug调试问题出在哪一步?[/quote]谢谢你,问题已解决。还是很通用的问题,out类型的参数在引用的时候,必须先初始化,但我没做初始化,所以一直提示该错误。哎,也是太新手的缘故。各位的解答都给了很大启发,再次致谢![/quote] 晕,好吧。
liaicheng12 2013-08-30
  • 打赏
  • 举报
回复
引用 15 楼 Herecs 的回复:
引用 13 楼 liaicheng12 的回复:
[quote=引用 12 楼 Herecs 的回复:] 看不出啥太大的问题,建议把存储过程改成程序中的方法,然后用debug调试一下。
其实这个方法也是试了,还是不行啊。pb新手,对这种问题完全误解啊。大神,求救~!
用debug调试问题出在哪一步?[/quote]谢谢你,问题已解决。还是很通用的问题,out类型的参数在引用的时候,必须先初始化,但我没做初始化,所以一直提示该错误。哎,也是太新手的缘故。各位的解答都给了很大启发,再次致谢!
heremei 2013-08-30
  • 打赏
  • 举报
回复
还有就是可能是字符集的问题。关于字符集的问题请参考: http://blog.csdn.net/robinson_0612/article/details/6030398 http://blog.csdn.net/lyn_bigdream/article/details/7473278
heremei 2013-08-30
  • 打赏
  • 举报
回复
引用 13 楼 liaicheng12 的回复:
引用 12 楼 Herecs 的回复:
看不出啥太大的问题,建议把存储过程改成程序中的方法,然后用debug调试一下。
其实这个方法也是试了,还是不行啊。pb新手,对这种问题完全误解啊。大神,求救~!
用debug调试问题出在哪一步?
liaicheng12 2013-08-29
  • 打赏
  • 举报
回复
引用 10 楼 lzp_lrp 的回复:
看一下sqlca.check_actionata( data, ls_actype, ls_return)这段代码,里面是怎么写的
我把过程改成函数后,试了一下,还是不行。我现在怀疑是这样:ls_return老是取不到从plsql中传回来的值,所以会不会是pb调用plsql的时候,pb的string和oracle的varchar2不兼容所致?
liaicheng12 2013-08-29
  • 打赏
  • 举报
回复
引用 12 楼 Herecs 的回复:
看不出啥太大的问题,建议把存储过程改成程序中的方法,然后用debug调试一下。
其实这个方法也是试了,还是不行啊。pb新手,对这种问题完全误解啊。大神,求救~!
heremei 2013-08-23
  • 打赏
  • 举报
回复
看不出啥太大的问题,建议把存储过程改成程序中的方法,然后用debug调试一下。
WorldMobile 2013-08-22
  • 打赏
  • 举报
回复
看一下sqlca.check_actionata( data, ls_actype, ls_return)这段代码,里面是怎么写的
liaicheng12 2013-08-22
  • 打赏
  • 举报
回复
引用 8 楼 lzp_lrp 的回复:
引用 7 楼 liaicheng12 的回复:
[quote=引用 6 楼 soar_angel 的回复:] 我是说你用程序跟出的传入参数值,在pl sql中测试,然后一步步跟,跟出存储中走到哪报的错。
这招早用过,plsql中是没问题的,pb中引用的时候才有问题。
看一下你的这句 sqlca.check_actionata( data, ls_actype, ls_return) 怀疑问题出在这里面了[/quote]也感觉问题出在这,目前尚未解决,不知道根据您经验,有什么更详细的信息。
liaicheng12 2013-08-22
  • 打赏
  • 举报
回复
引用 10 楼 lzp_lrp 的回复:
看一下sqlca.check_actionata( data, ls_actype, ls_return)这段代码,里面是怎么写的
里面就是‘sql代码’那段,在我发的帖子里面有的。 function check_actionata(p_actionata defect.actionata%type, p_actype orders.actype%type, p_return out varchar2) return number is l_count number; begin if trim(p_actionata) is null then p_return := null; return 1; end if; if trim(p_actype) is null then select count(ata) into l_count from ata where trim(ata) = trim(p_actionata) and not_for_defect is null; else select count(ata) into l_count from ata where trim(actype) = trim(p_actype) and trim(ata) = trim(p_actionata) and not_for_defect is null; end if; if l_count = 0 then p_return := zh_pub_function.get_message('DEFECT', -7); return 0; end if; p_return := null; return 1; end check_actionata;
WorldMobile 2013-08-18
  • 打赏
  • 举报
回复
引用 7 楼 liaicheng12 的回复:
引用 6 楼 soar_angel 的回复:
我是说你用程序跟出的传入参数值,在pl sql中测试,然后一步步跟,跟出存储中走到哪报的错。
这招早用过,plsql中是没问题的,pb中引用的时候才有问题。
看一下你的这句 sqlca.check_actionata( data, ls_actype, ls_return) 怀疑问题出在这里面了
soar_angel 2013-08-16
  • 打赏
  • 举报
回复
我是说你用程序跟出的传入参数值,在pl sql中测试,然后一步步跟,跟出存储中走到哪报的错。
liaicheng12 2013-08-16
  • 打赏
  • 举报
回复
引用 4 楼 soar_angel 的回复:
肯定能跟出程序走到哪报的错,只有找到那个节点,才有可能解决问题
是啊,我是用相同的办法测试的,然后messagebox('提示',sqlca.sqlerrtext)会提示相应的错误。所以,肯定是引用该存储过程时候产生的错误。
liaicheng12 2013-08-16
  • 打赏
  • 举报
回复
引用 6 楼 soar_angel 的回复:
我是说你用程序跟出的传入参数值,在pl sql中测试,然后一步步跟,跟出存储中走到哪报的错。
这招早用过,plsql中是没问题的,pb中引用的时候才有问题。
soar_angel 2013-08-15
  • 打赏
  • 举报
回复
肯定能跟出程序走到哪报的错,只有找到那个节点,才有可能解决问题
soar_angel 2013-08-15
  • 打赏
  • 举报
回复
你用程序跟,应该能跟出传入的参数值,然后用你获取到的值在pl sql中测试,不要自己随便传值测试呢。
liaicheng12 2013-08-15
  • 打赏
  • 举报
回复
引用 1 楼 soar_angel 的回复:
oracle 有测试功能,你用pl sql中的test测试,也会报错吗,99%是长度超了。
测试的时候是没错的。现在问题是我写的所有的函数或者过程调用的时候都会出现这个问题。大概场景是:有传入,穿出参数的时候,若通过select..into.. 赋值,则相应的会提示该错误。若不执行了另一分支,即不满足条件,不需要执行select..into..操作,则没问题。 网上查到有说要修改oracle缓冲区的大小,可问题是前辈其他人写的没问题啊。
soar_angel 2013-08-15
  • 打赏
  • 举报
回复
oracle 有测试功能,你用pl sql中的test测试,也会报错吗,99%是长度超了。
1、不安装Oracle客户连接Oracle 8的方法请将以下文件拷贝到运行文件所在目录 一、ODBC动态库 :ctl3d32.dll msvcrt40.dll odbc16gt.dll odbc32.dll odbc32gt.dll odbccp32.dll odbccr32.dll odbcint.dll

754

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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