我正在创建一个程序,可以在给定一个维度、一个度量和一个过滤器(where 子句)的情况下探索分析视图
drop procedure dynamicExploration;
create procedure dynamicExploration(in currentMeasure double, in filter_string
varchar(100), out dataSubset dataExplorationOutputType)
language sqlscript as
begin
dataSplitby = select CITY as ID, SUM(:currentMeasure) as SUM_MEASURE from
_SYS_BIC."package/analyticView" Group by CITY;
--dataSubset = APPLY_FILTER(:dataSplitby, :filter_string);
dataSubset = select * from :dataSplitBy;
end;
其中 dataSubset 是一种数据类型,定义如下:
drop type dataExplorationOutputType;
create type dataExplorationOutputType as table("ID" varchar(100), "SUM_MEASURE" double);
但是我收到了这个错误,请您检查一下有什么问题吗?
Could not execute 'create procedure dynamicExploration(in currentMeasure double, in
filter_string varchar(100), out ...' in 166 ms 8 µs .
SAP DBTech JDBC: [266] (at 200): inconsistent datatype: only numeric type is available
for aggregation function: line 4 col 36 (at pos 200)
我还尝试将 currentMeasure 定义为 varchar 但仍然遇到相同的错误。
我最终要实现的是创建一个存储过程,它可以帮助另一个过程根据用户定义的一组给定参数选择数据子集:维度、度量和过滤器。
下降过程动态探索;
create procedure dynamicExploration(in currentDimension varchar(100), in currentMeasure double, in filter_string
varchar(100), out dataSubset dataExplorationOutputType)
language sqlscript as
begin
dataSplitby = select :currentDimension as ID, SUM(:currentMeasure) as SUM_MEASURE from
_SYS_BIC."package/analyticView" Group by :currentDimension;
dataSubset = APPLY_FILTER(:dataSplitby, :filter_string);
--dataSubset = select * from :dataSplitBy;
end;
我已经创建了一个基于动态 SQL 进行这种动态探索的过程,不推荐使用此功能。我正在寻找的是一种更好的解决方案/想法来对分析视图(数据立方体)进行这种动态探索。
谢谢