我正在使用以下SQL脚本:
SELECT EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC) As COMMYEAR
FROM "_SYS_BIC"."tfx.adhoc.Greg_Test/CV_SALES_W_PRICINGCV_TEST"
GROUP BY EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC)
ORDER BY EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC) ASC;
,它运行良好,可以输出从2007年到2018年的列表。但是,如果我们包含以下行:
WHERE EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC) IN (2011, 2012, 2013)
将某些年份作为子集,HANA返回:
Could not execute 'SELECT EXTRACT(YEAR FROM FPCOMMNPERIOD_CALC) As COMMYEAR FROM ...' in 114 ms 271 µs .
[303]: invalid DATE, TIME or TIMESTAMP value: search table error: [6931] attribute value is not a date or wrong syntax
我正在使用Tableau连接到HANA,HANA会生成类似的过滤语句。我甚至尝试过滤1个值作为文本= '2018'
,但HANA继续输出错误。
列FPCOMMNPERIOD_CALC是一个计算列,其中ZTFPCOMN例如'2018007'(2018年期间007)。
leftstr("ZTFPCOMN",4)+'-'+rightstr("ZTFPCOMN",2)+'-'+'01')