In Teradata DB I have source table
create set table SRC_TABLE (
Some_Id varchar(2O) not null
);
This table is loaded with data from external system. I have target table
create set table DST_TABLE (
Some_Id decimal(4,0) not null
);
I need to copy rows from SRC_TABLE to DST_TABLE safely. There is a contract in place that external system will provide only values convertible to DECIMAL(4). However, is there any safe way how to select rows in SRC_TABLE which are not compliant with contract and may cause typecasting failure?
Update: I cannot use UDF functions due to restrictions in environment I am working in.
Finally with help of my colleagues I came to feasible solution. It has some limitations (sign is not considered, decimal part is not considered), but for IDs it works just fine.
So the records from
SRC_TABLEwhich cannot be converted toDECIMAL(4)can be obtained by select:EDIT:
More convenient is the way suggested by dnoeth in his answer to Convert char to int TeraData Sql , which also works in TD 13.10: