【问题标题】:How to fetch result of stored procedure in iReport?如何在 iReport 中获取存储过程的结果?
【发布时间】:2013-01-11 13:26:04
【问题描述】:

我使用的是 Ubuntu 12.04,iReport-4.7,MySQL,mysql-jdbc 驱动程序

我在 MySQL 中编写存储过程

DELIMITER //
CREATE PROCEDURE first()
BEGIN
select * from person where id in (11,22,33);
END //
DELIMITER;

返回 id & name 作为字段 并从 iReport 调用它

select id+1,name from (call first)

给我语法错误,

Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'call first)' at line 1

但是当我在查询执行器中运行call first 时,没有错误

我应该如何获得必填字段以进行进一步计算? 这在 MS-SQL 中是否可行?

【问题讨论】:

  • 也许你需要在你的 id+1 库上添加别名,比如 id+1 Id,name from etc...
  • @BizApps,我尝试使用 select (a.id+1) as b,a.name from (call first) as a,但它在 'call first)' 附近显示相同的语法错误跨度>

标签: mysql stored-procedures ireport


【解决方案1】:

这是不可能的。

您可以考虑使用临时表。

请查看此 SO 帖子:MySql: Can a stored procedure/function return a table?

问候

【讨论】:

  • '@BizApps',你给出的链接,我试图理解 MySQL 手册,但不是,抱歉。它要复杂得多,只有专家才能理解。你能详细说明一下吗?如果可能的话参考我的问题
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-10-24
  • 1970-01-01
  • 2020-10-23
  • 2011-07-24
  • 1970-01-01
  • 2017-08-01
  • 1970-01-01
相关资源
最近更新 更多