Skip to Content
0

Creating Function on HANA

Feb 13 at 06:03 PM

31

avatar image
Former Member

Hi,

I'm struggling to get a SQL function to HANA by HANA Studio. This is the code that I'm using:

CREATE FUNCTION "MBCF"."CUSTOM_PRODUCTION_ISSUED" (IN DENTRY nvarchar(20), IN ITEM varchar(20))

RETURNS AVG_PRICE DECIMAL(15, 6)

LANGUAGE SQLSCRIPT

AS

BEGIN

SELECT (SELECT ISNULL(AVG(ISNULL("Price", 0)), 0) FROM IGE1 WHERE "BaseRef" = :DENTRY AND "ItemCode" = :ITEM) INTO AVG_PRICE FROM DUMMY;

END;

But, the following error is presented when executing:

inconsistent datatype: DECIMAL or INT are invalid function argument types: line 7 col 24 (at pos 196)

Any help?

Thanks

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

1 Answer

Best Answer
avatar image
Former Member Feb 13 at 06:49 PM
0

Hi,

I did change the ISNULL with a COALESCE and it worked.

Thanks,

Share
10 |10000 characters needed characters left characters exceeded