I have procedure below that partitions tables with using RANGE partitions. The tables already have data in them. IF i comment out the CLOSE cursor statement it works fine.
I am getting the following error
Could not execute 'CREATE PROCEDURE sp_PartitionTable ( in p_TableName varchar ) LANGUAGE SQLSCRIPT AS query_str ...' in 36 ms 59 µs .
SAP DBTech JDBC: [2048]: column store error: [34011] failed to save calculation scenario : The following errors occured: Inconsistent calculation model (34011)
Details (Errors):
- CalculationNode ($$_SYS_SS2_RESULT$$): Internal compiler error at OPTESSA_MLS.SP_PARTITIONTABLE: line 17 col 1 (at pos 323).
CREATE PROCEDURE sp_PartitionTable
(
in p_TableName varchar
)
LANGUAGE SQLSCRIPT AS
query_str varchar(4000);
CURSOR c_cursor1 FOR SELECT scen_id FROM scenario ORDER BY scen_id;
BEGIN
query_str:= '';
FOR cur_row as c_cursor1 DO
query_str := :query_str || 'PARTITION VALUE = ' || cur_row.scen_id ||',';
END FOR;
CLOSE c_cursor1;
query_str := :query_str || 'PARTITION OTHERS)';
EXEC 'alter table ' || :p_TableName || ' PARTITION BY RANGE(scen_id)(' || :query_str;
END;