on 08-11-2015 10:08 AM
Hi Gurus,
I want to check string is correct timestamp format or not in SQLScript procedure .
like followings
------------------
dt = '2015/08/99'
ti = '00:00:00'
dtstr = dt || ' ' || ti
------------------
I want to check dtstr is correct datetime or not before next process.
*above example is 'wrong' , '2015/08/99' is not correct date.
But it seems to me , HANA doesn't have ISTIMESTAMP() / ISDATE() / ISTIME() or similar functions.
Do you have any idea ?
Regards,
JT
Hi JT
How about this ? You can customize following function to your required.
------------------
CREATE FUNCTION isDateTime(inputval NVARCHAR(30))
RETURNS RETURNVAL INTEGER
LANGUAGE SQLSCRIPT
AS
BEGIN
DECLARE DT TimeStamp;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
RETURNVAL := 0;
END;
select To_TimeStamp(:inputVal) INTO DT from dummy; //If inputval is strange format , this statement will raise error then go to handler , returnval=0.
RETURNVAL := 1;
END;
-----------------
Do at your own risk !
Regards,
Naoto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jim
One option you could use is to Generate Time Data and compare the data generated to your date to see if it exists there and is therefore valid. More details on generating time data are in the SAP HANA Developer Guide for SAP HANA Studio downloadable from service.sap.com/hana
Ruth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.