Skip to Content
0
Feb 13, 2018 at 06:03 PM

Creating Function on HANA

877 Views

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