datatype check

UDA
Enthusiast

datatype check

hi

I have data coming in as character and before inserting, I need to check if a value is a float. how can I do that ?
4 REPLIES
Enthusiast

Re: datatype check

How about trying to cast the value and catching the return code?
Teradata Employee

Re: datatype check

This might be one way

insert into foo select case when type(my_col) = 'FLOAT' then my_col else null end from my_table;
Enthusiast

Re: datatype check

u can use POSITION function of teradata.
u can store position('.' in ) in a variable.
If this variable is greater than 0 then it is a float value and if not then it does not contain any float value.
Enthusiast

Re: datatype check

Syntax:-

select position('.' in column_name) from table_name;