cancel
Showing results for 
Search instead for 
Did you mean: 

Table Variables - MODIFY in HANA

kgaurav2k14
Participant
0 Kudos

Hi Guys,

I was going through the SQL developer guide to find a solution about Table variables with below link.

SQL HANA Developer Guide - Table Variables

I found that there is a way through which we can modify the contents of table inside procedures. Also, through a function called RECORD_COUNT, we can find the number of records a table contains. I applied that in my table function but I am facing syntax errors. I have followed exact syntax which is mentioned in above link. Please help.

FUNCTION "BIUSER"."GK1.Func_Proc::t1acdoca" ( ) 
RETURNS "ACDCA" -- Table type
LANGUAGE SQLSCRIPT SQL
SECURITY INVOKER 
DEFAULT SCHEMA BIUSER
AS
lv_row_count INTEGER;IDX INTEGER;MAXID INTEGER;
BEGIN
DECLARE TEMP ACDCA; -- ACDCA is a table type
TEMP = SELECT "RLDNR", "RBUKRS", "GJAHR", "BELNR", "DOCLN", "RYEAR", "AUGBL", "AUGGJ", "BLART", "WSL", "HSL"
FROM "_SYS_BIC"."GK1/CV_ACDOCA"; 
MAXID = RECORD_COUNT(:TEMP);   ----SYNTAX ERROR
FOR IDX IN 1..MAXIDX DO
--Logic to modify table 
TEMP[IDX] = (:TEMP.RLDNR[:IDX], '0L'); -- SYNTAX ERROR
END FOR;
RETURN :TEMP;
END;

Thanks,

Gaurav

pfefferf
Active Contributor

Please can you add the information which HANA version/revision you are using.

Regarding the first syntax error I assume you are using a HANA 1.0 SPSx system. The RECORD_COUNT function is available with HANA 2.0 SPS0.

Regarding the second error you should explain what you wanna try to do with which operators/functions. At the moment it looks pretty crazy and has nothing to do with the table modification operations you have placed the link to.

Regards,
Florian

kgaurav2k14
Participant
0 Kudos

Hi Florian,

Yes, you are right. I am indeed working on version 1.0 SPS12. Hence, closing the question as these features would be available from 2.0 SPS0 onwards.

Thanks,

Gaurav

Accepted Solutions (0)

Answers (0)