0

When executed against HANA 102.5, the following batch

CREATE PROCEDURE DUMMY( message nvarchar(254) )
AS
BEGIN
/* Do nothing */
END;

CREATE PROCEDURE cur_test
AS  CURSOR cur FOR
    SELECT 'code' FROM DUMMY;
    code NVARCHAR(64);
BEGIN
    OPEN cur;
    CALL DUMMY( 'Start' );
    WHILE 1 = 1 DO SEQUENTIAL EXECUTION
        FETCH cur INTO code;
        BREAK;
    END WHILE;
    CALL DUMMY( 'Finish' );
    CLOSE cur;
END;

CALL cur_test;

fails with the error:

SqlScript: Unsupported type of lhs:CUR:unknown type

Why does this happen? Notice that when I remove either call to DUMMY it works. When I comment the FETCH statement it works as well. Removing the WHILE loop and leaving the body alone also makes the error disappear.

Anton Shepelev
  • 922
  • 9
  • 19
  • If a declare the same procedure with `SEQUENTIAL EXECUTION` the error disappears. – Anton Shepelev Nov 02 '16 at 15:16
  • 1
    Which SAP HANA revision are you working with? I just tried your code against a rev. 112 and received no error. – Lars Br. Nov 02 '16 at 21:36
  • 1
    I am on 102.5. Of course, since HANA parallelizes everything by default it may not know which `CALL` to execute first, so `SEQUENTIAL` solves the problem. I wonder how 112 decides it. Thank you, Lars. – Anton Shepelev Nov 04 '16 at 11:33
  • In fact HANA doesn't simply parallelize _everything_ but instead analyses the dependencies between statements and builds data flow graphs internally to ensure consistency. Since I cannot reproduce your problem, I don't know what causes the error. – Lars Br. Nov 08 '16 at 10:03
  • Thank you, Lars. I shall return to this problem when we upgrade to a later HANA version. – Anton Shepelev Nov 08 '16 at 11:37

0 Answers0