Skip to Content
avatar image
Former Member

Solution for "feature not supported: RETURN EXPRESSION"?

Hi,

Working on Hana Express edition with following details.

HDB version info:
  version:             2.00.000.00.1479874437
  branch:              fa/hana2sp00
  git hash:            2a3d5a559e1134fece774a8e60c6237ac1112d1f
  git merge time:      2016-11-23 05:13:57
  weekstone:           0000.00.0
  compile date:        2016-11-23 05:23:56
  compile host:        ld7272
  compile type:        rel

The code that I am trying to get to work is as follows. The error received on procedure execution is "feature not supported: RETURN EXPRESSION".

Actual requirement is to read a session context variable, which I got to work with a table function but that requires a SQL to be embedded in all places where the context variable is needed. I was trying to come up with a wrapper function around that other table function, so that the code still is maintainable.

What am I missing here?

DROP FUNCTION FTest;
CREATE FUNCTION FTest RETURNS sValue VARCHAR(1) 
language sqlscript 
reads sql data AS
begin
	RETURN 'Y';
END;


drop PROCEDURE ProTest ;
CREATE PROCEDURE ProTest 
AS
	sReceive VARCHAR(1);
BEGIN
	sReceive = FTest();
END;


CALL ProTest;


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Mar 08, 2017 at 03:11 PM

    You can delete the line with "RETURN sValue;" from your function. This is the statement which causes the error. It is enough just to set the "return parameter" sValue.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 08, 2017 at 04:32 AM

    Any inputs please?

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 08, 2017 at 06:31 AM

    The error is in the function itself.

    You are trying to return an expression value with

    return 'Y';

    But you have to assign your return value to the sValue variable defined as returning parameter:

    sValue = 'Y';

    Just replace your "return statement" by the sValue parameter assigned in the function and it will work.

    Regards,
    Florian

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 08, 2017 at 11:45 AM

    Tried this as following. Hope I understood what you meant.

    I am running this via Eclipse and still get

    Could not execute 'CALL ProTest'
    SAP DBTech JDBC: [7]: feature not supported: RETURN EXPRESSION
    
    DROP FUNCTION FTest;
    CREATE FUNCTION FTest RETURNS sValue VARCHAR(1) 
    language sqlscript 
    reads sql data AS
    	sValue VARCHAR(1);
    begin
    	sValue = 'Y';
    	RETURN sValue;
    END;
    
    drop PROCEDURE ProTest ;
    CREATE PROCEDURE ProTest 
    AS
    	sReceive VARCHAR(1);
    BEGIN
    	sReceive = FTest();
    END;
    
    
    CALL ProTest;
    
    
    Add comment
    10|10000 characters needed characters exceeded