You can use a UDF to find the data causing error.
Although the UDF might not complete, it will be usefull to narrow down the error.
Sample UDF:
Code:
--
-- Description: Returns 0 when the input string is a valid integer or decimal representation,
-- otherwise returns > 0.
--
-- Validity test cases.
-- Test 1 : All characters are '0123456789.-+' or blank.
-- Test 2 : No other characters exists left of '-' or '+' except blank(s).
-- Test 3-1: Number of '-' or '+' should be 0 or 1.
-- Test 3-2: Number of '.' should be 0 or 1.
-- Test 4 : No blanks are allowed between characters except after leading '-' or '+'.
-- Test 5 : It should have at least one digit character.
--
CREATE FUNCTION ISNUMERIC (Source VARCHAR(40))
RETURNS INTEGER
LANGUAGE SQL
DETERMINISTIC
NO EXTERNAL ACTION
RETURN
CASE
WHEN translate(source,'','0123456789.-+') <> '' THEN 10
WHEN posstr(ltrim(source),'-') > 1
OR posstr(ltrim(source),'+') > 1 THEN 20
WHEN length(rtrim(ltrim(translate(source,'','0123456789.')))) > 1 THEN 31
WHEN length(rtrim(ltrim(translate(source,'','0123456789-+')))) > 1 THEN 32
WHEN posstr(ltrim(rtrim(translate(source,'','-+'))),' ') > 0 THEN 40
WHEN translate(source,'','.-+') = '' THEN 50
ELSE 0
END
Example of use of the UDF:
Code:
SELECT c1
, ISNUMERIC(c1)
FROM table_name
WHERE ISNUMERIC(c1) > 0
FETCH FIRST 10 ROWS ONLY
;