database - 带有数组参数的 Voltdb 存储过程
问题描述
我有一个采用字符串数组的 VoltDB 存储过程,String[]
它已成功加载,但我似乎无法使用带有 exec 的 VoltDB SQL 查询接口执行存储过程。
也不能在 sqlcmd 界面中执行。
我收到此错误:
错误:PrepareStatement 错误:过程“StoredProcedure”的参数计数无效(收到:3,预期:2,)
如何构造 exec 语句以从 VoltDB 检索存储过程的结果?
解决方案
不幸的是,在使用 sqlcmd 接口时,没有很好的方法将数组作为参数传递。如果你需要测试这个程序,最好的方法是编写一个简单的java/python脚本来调用带有数组的程序。在 python 中,它看起来像这样:
#!/usr/bin/env python
from voltdbclient import *
client = FastSerializer("localhost", 21212)
# declare array parameters the same as primitives
fooProc = VoltProcedure( client, "Foo", [FastSerializer.VOLTTYPE_BIGINT])
# the set of all parameters is the outer array, the inner array is the parameter value
fooResponse = fooProc.call( [ [1, 2, 3, 4, 5] ] )
for x in fooResponse.tables:
print x
全面披露:我在 VoltDB 工作。
推荐阅读
- git - 错误此存储库已移动。请使用新位置
- angular - Multipart POST 适用于 Postman,但不适用于 Angular Http Client
- windows - 如何使用 ENV 变量在 Windows 中为 Kubectl 创建别名?
- flutter - 在运行时从单独的文件中导入列表
- python - 为什么 VSCode 无法识别 sqlite3?
- wxwidgets - 您如何使用 wxWidgets 分发软件?
- google-cloud-platform - 如何编辑 App.Yaml(谷歌云平台)
- excel - 单元格是否为空白的公式,它将前一个单元格视为该单元格的值并将单元格相加
- pandas - 使用带有两个字符作为分隔符的 pandas 从文本中加载数据
- intellij-idea - Intellij 快捷方式直接转到任何变量类或方法