Skip to Content

Creating Function on HANA

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Feb 13 at 06:49 PM

    Hi,

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

    Thanks,

    Add comment
    10|10000 characters needed characters exceeded