How to convert string field and use for Where clause.Am getting exception like this please help to find the wrong thing.
select * from student
where (cast (nvl(linerevnum,'0') as int)) = 1
linerevnum is varchar2
Exception : invalid number
How to convert string field and use for Where clause.Am getting exception like this please help to find the wrong thing.
select * from student
where (cast (nvl(linerevnum,'0') as int)) = 1
linerevnum is varchar2
Exception : invalid number
Compare only when is numeric
select * from student
where
(
case when ISNUMERIC( linerevnum )
then cast (linerevnum as int)
else null
end ) = 1
or simple:
select * from student
linerevnum = '1'