I have the below SQL that is throwing a "Numeric data not valid" error when executed:
SELECT WORKKEY , WRKTITLE, INT(SUBSTR(WRKTITLE , 26, 8) )
FROM IACDTAA.IACWTL
WHERE
REGEXP_LIKE(TRIM(WRKTITLE), '^[0-9]{1,4} ARTX LU 079 PUBLDTE=[0-9]{8} A$')
AND WORKKEY IN (SELECT WORKKEY FROM IACDTAA.IACNTC WHERE NTFCTLKEY = 195586 )
AND INT(SUBSTR(WRKTITLE , 26, 8) ) > 0 ;
The problem seems to be the comparison condition INT(SUBSTR(WRKTITLE , 26, 8) ) > 0
Basically, the regular expression is trying to find out records where the WRKTITLE field has values such as :
0048 ARTX LU 079 PUBLDTE=19880708 A
0060 ARTX LU 079 PUBLDTE=20120101 A
But to me it appears that the SQL is actually selecting records where the WRKTITLE is not in this format and that results in the INT function to be applied to "non-numeric" values.
What could be going wrong here ?