I am trying to use
sel accnt_no from abc
where cast(accnt_no as bignit) mod 2 = 0
i am getting bad character error in this..what could be the possible issue in here?
Well, the issue is a bad character :-)
You simply got some non-digits in
acct_no. Switch to TO_NUMBER instead:
WHERE TO_NUMBER(acct_no) MOD 2 = 0
You can also use it to find the bad rows
WHERE TO_NUMBER(acct_no) IS NULL
I was testing this function and created a table with varchar(3) column(Col1) and inserted 'A'. when i run this - sel Col1 from mytab where to_number(col1) is null, it gives me an error saying - invalid char A in number string. i was assuming it would give me 'A', as this is the bad data.
Thanks , Samir