Hi,
Try this....
SELECT
CASE WHEN length(translate(substr(T_BILLSUMMARY.OPDNUMBER,1,6),' +-.0123456789',' ')) > 0
THEN 'Wrong Value'
ELSE cast(substr(T_BILLSUMMARY.OPDNUMBER,1,6) as INTEGER)
END
as OPD,
substr(T_BILLSUMMARY.OPDNUMBER,8,12) as OPDYEAR,
T_BILLSUMMARY.BILLTONAME
FROM T_BILLSUMMARY
where cast(substr(T_BILLSUMMARY.OPDNUMBER,1,6) as NUMBER)=10805;
Hope this will help you.
Cheers