Hi All,
I am working on a requirement to build a custom function in HANA DB to convert input datestring in the format 'YYYYMMDD'
to the format 'MM/DD/YYYY HH:MI:SS AM'. But the function I ve written is not returning output as expected.
For example if the input is '20200623' the output date format should be like : 06/23/2020 12:00:00 AM. To get this format i ve tried the following function.
CREATE FUNCTION "ERPDEV".FN_CONVERTSAPDATE(v_in VARCHAR(8)) RETURNS v_out DATE LANGUAGE SQLSCRIPT AS BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN v_out := NULL; END; v_out := TO_VARCHAR(TO_DATE(:v_in,'YYYYMMDD'), 'MM/DD/YYYY HH:MI:SS AM'); END;
But it is not returning the output as expected. Instead it is returning a ? as output. Please help me on this.

