Skip to Content
0
Apr 02, 2015 at 02:19 PM

Issue with Arrays in SQL (Column store error: [34011])

30 Views

Hello,

I have an error when using arrays in sql coding in my calculation view

My target is to have the different values of the array.

In this sample coding, I want to have the first value in the array (original coding is much more complex)

I get my data from table ZTAB, only column COL which is NVARCHAR(1)

Coding is as bellow:

BEGIN

DECLARE ma      NVARCHAR(1) ARRAY;
DECLARE ar      NVARCHAR(1) ARRAY;
DECLARE lv_ar   NVARCHAR(1);



lt_tab = select distinct col from ztab;                  
ar := ARRAY_AGG(:lt_tab.col);
lv_ar := :ar[1];                     
                     
var_out = UNNEST(:ma, :ar) AS ("MANDT", "COL");
              
END ;




The problem come from line 7 (lv_ar := :ar[1];), if I delete line 7 activation will be ok...

For sure it's a conversion error in line 7 but I don't understand why...

Error text:

Internal deployment of object failed;Repository:

Encountered an error in repository runtime extension;Internal

Error:Deploy Calculation View: SQL: transaction rolled back by an internal error:

column store error: [34011] failed to save calculation scenario :

The following errors occured: Inconsistent calculation model (34011)

Thank you in advance for your help.

Moez.