Informix:带有输出参数的程序?
我搜索了很多,但找不到任何东西..我只是想问是否有任何方法可以创建和调用不带参数的过程(Informix)。我知道如何返回一个或多个值(对于过程和函数),但这不是我想要的。如果 Informix 不允许输出参数,那就真的很奇怪了。
提前感谢!
编辑:是的,我看到这是可能的,但我仍然无法执行这样的过程。例如:
CREATE PROCEDURE mytest(batch INT,OUT p_out INT)
DEFINE inc INTEGER;
LET inc = 1;
LET p_out = 5;
END PROCEDURE;
我收到的是:
例程 mytest 无法解析
,这种情况仅在执行带有输出参数的函数时发生。
I searched a lot, but couldn't find anything.. I just want to ask if there's any way to create and call a procedure (Informix) with out parameters. I know how to return one or more values (for procedures and for functions), but this is not what I want. It would be really strange, if Informix does not allow output parameters..
Thanks in advance!
EDIT: Yes, I saw it's possible, but I still can't execute such procedure. For example:
CREATE PROCEDURE mytest(batch INT,OUT p_out INT)
DEFINE inc INTEGER;
LET inc = 1;
LET p_out = 5;
END PROCEDURE;
and what I receive is:
The routine mytest can not be resolved
and this happens only on executing functions with output parameters..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么需要“out”参数? Informix 过程可以从单个调用返回多个值(或者,在本例中,返回单个值):
可以使用 OUT 参数的位置有限。一种是在查询中 - 有一个名称 SLV(语句局部变量)出现在一些错误消息中。我相信也有一种方法可以通过 Java (JDBC) 获取 OUT 参数。 AFAIK,其他 API 不允许这样做。
为 Informix 编写的代码假定它不需要输出参数。从其他(贫乏的?)系统迁移到 Informix 的代码(这些系统不从单个过程提供多个输出值)需要重新考虑,以便与 Informix 合理地配合使用。
Why do you need 'out' parameters? Informix procedures can return multiple values from a single call (or, in this case, a single value):
There are only a limited number of places where you can use an OUT parameter. One is in a query - there is a name SLV (statement local variable) that turns up in some error messages. I believe there's a way to get to OUT parameters via Java (JDBC) too. AFAIK, other APIs do not allow it.
Code written for Informix assumes that it won't need output parameters. Code migrated to Informix from other (impoverished?) systems that do not provide multiple output values from a single procedure need to be rethought to work sensibly with Informix.