Informix:具有输出参数的过程? [英] Informix: procedure with output parameters?
问题描述
我进行了很多搜索,但找不到任何东西..我只是想问问是否有任何方法可以创建和调用不带参数的过程( Informix ).我知道如何返回一个或多个值(用于过程和函数),但这不是我想要的.如果Informix不允许输出参数,那将真的很奇怪.
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..
提前谢谢!
编辑:是的,我看到了可能,但是我仍然无法执行该过程.例如:
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;
我收到的是:
常规mytest无法解决
这仅在执行带有输出参数的函数时发生.
and this happens only on executing functions with output parameters..
推荐答案
为什么需要'out'参数? Informix过程可以从单个调用(或在这种情况下,单个值)返回多个值:
Why do you need 'out' parameters? Informix procedures can return multiple values from a single call (or, in this case, a single value):
CREATE PROCEDURE mytest(batch INT) RETURNING INT AS p_out;
DEFINE inc INTEGER;
DEFINE p_out INTEGER;
LET inc = 1;
LET p_out = batch + inc;
RETURN p_out;
END PROCEDURE;
只有少数几个地方可以使用OUT参数.一个是在查询中-有一个名称SLV(语句局部变量)出现在一些错误消息中.我相信也有一种通过Java(JDBC)获取OUT参数的方法. AFAIK,其他API不允许.
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.
为Informix编写的代码假定它不需要输出参数.从其他(贫乏的?)系统迁移到Informix的代码不能从单个过程中提供多个输出值,因此需要重新考虑以使其与Informix明智地协同工作.
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.
这篇关于Informix:具有输出参数的过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!