Informix:具有输出参数的过程?

编程入门 行业动态 更新时间:2024-10-28 08:24:17
本文介绍了Informix:具有输出参数的过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我进行了很多搜索,但找不到任何东西..我只是想问问是否有任何方法可以创建和调用不带参数的过程( 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:具有输出参数的过程?

本文发布于:2023-11-09 05:11:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571471.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   过程   Informix

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!