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