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

How to catch the data type conversion error and return null for the calculated column

$
0
0

Dear All,

 

I am using "SELECT *, TO_TIMESTAMP (MY_DATE, 'YYYY-MM-DD') "to timestamp" FROM TEST_DATE_STRING;" to convert the date in string to the timestamp but I could not make sure all the date in string with right format. The sql will raise error when conversion failed but my requirement is to let it return NULL instead of stop the process.

 

A way I could think of is to write a procedure and loop the every record using CURSOR, catch the exception in the procedure. But I do NOT want to use that way as it looks over complicated for my simple requirement and also the performance is definitely not good.

 

Please help. Thanks!


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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