0

大家好,我有一个与 jxls/sql 相关的问题,希望我能得到你的帮助。

我正在尝试在 excel 模板中编写 sql,在 jdeveloper 中运行它以启动我的应用程序,一旦用户单击按钮,应用程序就会根据我创建的模板生成一个 excel 表单。

我在 oracle sql 10g 中尝试了我的代码,它运行良好并给了我想要的结果,但是一旦我将它放入 excel 模板(我遵循了所需的 jxls 文档),应用程序将无法呈现模板并返回一个表单大部头书。

也许我在不应该这样写的sql代码中有错误?

我会感谢您的帮助提前谢谢您!

这是 Excel 中的 SQL 代码:

        <jx:forEach items="${rm.exec("WITH rvus AS (
SELECT period_last_day, cpts.cpt, fy.fiscal_quarter(period_last_day) AS quarter, work_rvu, units, charge_amount
FROM FIN.idxchg_credited_clp_current idx JOIN DOM.pc_cpts cpts on idx.cpt = cpts.cpt
WHERE 
period_last_day >= fy.fiscal_year_start('30-JUN-13')
AND period_last_day <= '30-JUN-13'
),totals as ( SELECT cpt, quarter, sum(work_rvu) as total_rvu, sum(units) as total_units, sum(charge_amount)
as total_charge
FROM rvus
GROUP BY quarter,cpt
)
SELECT cpt,
SUM(DECODE(QUARTER, 1,total_rvu))Q1TotalRvu,
SUM(DECODE(QUARTER, 1,total_units))Q1TotalUnits,
SUM(DECODE(QUARTER, 1,total_charge))Q1Totalcharge,
SUM(DECODE(QUARTER, 2,total_rvu))Q2TotalRvu,
SUM(DECODE(QUARTER, 2,total_units))Q2TotalUnits,
SUM(DECODE(QUARTER, 2,total_charge))Q2TotalCharge,
SUM(DECODE(QUARTER, 3,total_rvu))Q3TotalRvu,
SUM(DECODE(QUARTER, 3,total_units))Q3TotalUnits,
SUM(DECODE(QUARTER, 3,total_charge))Q3TotalCharge,
SUM(DECODE(QUARTER, 4,total_rvu))Q4TotalRvu,
SUM(DECODE(QUARTER, 4,total_units))Q4TotalUnits,
SUM(DECODE(QUARTER, 4,total_charge))Q4TotalCharge
FROM totals group by cpt}" var="totals">

</jx:forEach> 
4

1 回答 1

-1

看起来您需要关闭 rm.exec 语句:

FROM totals group by cpt}" var="totals">

应该

FROM totals group by cpt")}" var="totals">

于 2015-03-12T19:01:50.873 回答