I am running the below mentioned query in my Oracle client and i am getting
ORA-01722: invalid number
error. I know the issue is due to the TAG_VALUE column being of type "varchar2
" and i am converting it to number and then using that field in where clause. I have tried using "CAST
" function but that is also not helping.
If i run the query neglecting the last where condition with code WHERE (P.TAG_VALUE > '100')
then i am getting the result but including the last where clause gives me error.
SELECT DISTINCT
count(P.CREATED_DATETIME)
FROM
(
select OUTPUT_TAG_ID,TO_NUMBER(TAG_VAL,'9999.99') AS
TAG_VALUE,TAG_VAL_TS,CREATED_DATETIME
from OV80STG.PRCSD_DATA_OUTPUT_ARCHIVE
where MODEL_CODE='MDLADV1538'
AND TAG_VAL <> 'U_Transfer_rate'
) P
WHERE
(P.TAG_VALUE > '100')
Any suggestion will be appreciated. Thanks.
(P.TAG_VALUE > '100')
– JensSELECT * FROM OV80STG.PRCSD_DATA_OUTPUT_ARCHIVE WHERE REGEXP_LIKE(TAG_VALUE, '[^[:digit:]]')
returns any rows?. It is to check if non-numeric characters exists in the column – Kaushik NayakTAG_VALUE
column. You must replace them from all those records fetched. – Kaushik Nayak