具有动态占位符的SAP HANA SQL查询 [英] SAP HANA SQL Query with Dynamic Placeholder

查看:212
本文介绍了具有动态占位符的SAP HANA SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个查询,该查询将当前年份作为占位符参数传递,该参数现在已被硬编码.我怎么能过今年呢?我已经看到了几种不同的潜在解决方案,但是大多数解决方案都在HANA Studio中或涉及动态SQL生成.

I have a query that is passing the current year as a placeholder parameter that right now is hard coded. How can I have this just pass the current year? I've seen a few different potential solutions but most of them are in HANA Studio or involve dynamic SQL generation.

我正在将SQL放入Tableau,因此它们都不在表中.

I'm putting the SQL into Tableau so those are both off the table.

...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.... 

推荐答案

  • 删除简历的参数输入
  • 添加此表达式:year(now())
  • 如果您无权操纵CV,请在查询中使用:

    If you don't have access to manipulate the CV, into your query use:

    • ('PLACEHOLDER'=(''$$ IPCurrentYear $$',从DUMMY中选择year(now())))

    致谢

    这篇关于具有动态占位符的SAP HANA SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆