【发布时间】: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