Quantcast
Viewing all articles
Browse latest Browse all 3548

Re: Scalar Function not working to Convert Format of Field

Hello Subrat,

 

your function does not work, because the format provided for the TO_DATE function does not match your input date. The conversion will fail. You can test that using the function in a select executed in the console: SELECT your_function(DATE_NEW => '20160617') FROM dummy;

 

Your function should look like:

FUNCTION "MISC"."test.misc.functions::convertDatetoExternal" ( DATE_NEW varchar(8) )  RETURNS DATE_1 varchar(10)  LANGUAGE SQLSCRIPT  SQL SECURITY INVOKER AS
BEGIN  DATE_1 := to_varchar(to_date(:DATE_NEW, 'YYYYMMDD'), 'YYYY.MM.DD');
END;

 

Regards,

Florian


Viewing all articles
Browse latest Browse all 3548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>