带动态占位符的SAP HANA SQL查询

问题描述 投票:2回答:1

我有一个查询,它将当前年份作为占位符参数传递,现在硬编码。我如何才能通过当年?我已经看到了一些不同的潜在解决方案,但大多数都在HANA Studio中或涉及动态SQL生成。

我将SQL放入Tableau,所以这些都不在桌面上。

...sum("StockInQualityInspection") as in_quality,
         sum("StockInTransit") as its
  from "_SYS_BIC"."stream.models.marketing.poly/InventoryQuery" ('PLACEHOLDER' = ('$$IPCurrentYear$$', '2018'))
  where "StockValuatedUnrestrictedUse" <> 0 or "StockInQualityInspection" <> 0 or "StockInTransit" <> 0
  group by case when "ReceivingPlant" is null then "Plant" else "ReceivingPlant" end, 
           case.... 
hana
1个回答
0
投票
  • 删除CV的参数输入
  • 添加以下表达式:year(now())

如果您无权操纵CV,请使用以下内容:

  • ('PLACEHOLDER'=('$$ IPCurrentYear $$',选择年份(现在())来自DUMMY))

问候

© www.soinside.com 2019 - 2024. All rights reserved.