Skip to Content
0

Solution for "feature not supported: RETURN EXPRESSION"?

Feb 28, 2017 at 11:30 AM

158

avatar image
Former Member

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;


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Florian Pfeffer
Mar 08, 2017 at 03:11 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 08, 2017 at 04:32 AM
0

Any inputs please?

Share
10 |10000 characters needed characters left characters exceeded
Florian Pfeffer
Mar 08, 2017 at 06:31 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 08, 2017 at 11:45 AM
0

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;

Share
10 |10000 characters needed characters left characters exceeded