BIRT 报告:org.eclipse.birt.report.engine.api.EngineException:报告 运行 时发生错误

BIRT Reports: org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report

谁能帮我解决这个异常?

在报表数据集中使用以下 SQL 查询:

declare @CargoiQCarrierInfo table(
       C2K_Identifier varchar(1)
)

insert into @CargoiQCarrierInfo select '1' 

select C2K_Identifier from @CargoiQCarrierInfo;

预览 SQL 查询时出现以下异常:

org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
    at org.eclipse.birt.report.engine.api.impl.DatasetPreviewTask.doRun(DatasetPreviewTask.java:316)
    at org.eclipse.birt.report.engine.api.impl.DatasetPreviewTask.runDataset(DatasetPreviewTask.java:278)
    at org.eclipse.birt.report.engine.api.impl.DatasetPreviewTask.execute(DatasetPreviewTask.java:89)
    at org.eclipse.birt.report.designer.data.ui.dataset.DataSetPreviewer.preview(DataSetPreviewer.java:68)
    at org.eclipse.birt.report.designer.data.ui.dataset.ResultSetPreviewPage.run(ResultSetPreviewPage.java:372)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: org.eclipse.birt.data.engine.odaconsumer.OdaDataException: Cannot get the result set metadata.
    org.eclipse.birt.report.data.oda.jdbc.JDBCException: SQL statement does not return a ResultSet object.
SQL error #1:The statement did not return a result set.
 ;
    com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.
    at org.eclipse.birt.data.engine.odaconsumer.ExceptionHandler.newException(ExceptionHandler.java:52)
    at org.eclipse.birt.data.engine.odaconsumer.ExceptionHandler.throwException(ExceptionHandler.java:108)
    at org.eclipse.birt.data.engine.odaconsumer.ExceptionHandler.throwException(ExceptionHandler.java:84)
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.getRuntimeMetaData(PreparedStatement.java:414)
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.getProjectedColumns(PreparedStatement.java:377)
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.doGetMetaData(PreparedStatement.java:347)
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.execute(PreparedStatement.java:563)
    at org.eclipse.birt.data.engine.executor.DataSourceQuery.execute(DataSourceQuery.java:980)
    at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQueryExecutor.executeOdiQuery(PreparedOdaDSQuery.java:607)
    at org.eclipse.birt.data.engine.impl.QueryExecutor.execute(QueryExecutor.java:1251)
    at org.eclipse.birt.data.engine.impl.ServiceForQueryResults.executeQuery(ServiceForQueryResults.java:233)
    at org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResults.java:178)
    at org.eclipse.birt.data.engine.impl.QueryResults.getResultMetaData(QueryResults.java:132)
    at org.eclipse.birt.report.engine.api.impl.DatasetPreviewTask.extractQuery(DatasetPreviewTask.java:350)
    at org.eclipse.birt.report.engine.api.impl.DatasetPreviewTask.doRun(DatasetPreviewTask.java:307)
    ... 5 more

使用下面的方法可以解决这个问题。

SET NOCOUNT ON;

declare @CargoiQCarrierInfo table(
       C2K_Identifier varchar(1)
)

insert into @CargoiQCarrierInfo select '1' 

select C2K_Identifier from @CargoiQCarrierInfo;