Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Input parameter nvarchar with the value NULL for the table UDF

$
0
0

Hello,

 

I have a problem with Table UDF. If a input parameter is nvarchar with the value NULL for the table UDF it will be changed to an empty string in UDF. I use SAP HANA Rev 85.

 

---- The table UDF  ---------------------------------------------

 

create function SP_TEST_FN_PARAM_NULL

(

    p nvarchar(100)

)

returns table

(

    "CHECK"   nvarchar(100),

    "LENGTH"  integer

)

language sqlscript

as

begin

    return select case when :p is null  then 'p is null' else 'p is not null' end as "CHECK",

length(:p) as "LENGTH" from dummy;

end;

 

---- Test calls ----------------------------------------------------

                                            ------ Test result -----

                                            -- CHECK          LENGTH

select * from SP_TEST_FN_PARAM_NULL('123'); -- p is not null   3

select * from SP_TEST_FN_PARAM_NULL('');    -- p is not null   0

select * from SP_TEST_FN_PARAM_NULL(null);  -- p is not null   0  <= WHY ???

 

---- End -----------------------------------------------------------

 

Cansomebodyhelpmetosolve this problem?

 

Best regards,

Y.Hu


Viewing all articles
Browse latest Browse all 6412

Trending Articles