Search code examples
sqloracle-databaseora-01722

Oracle - select * where column>5


I am trying to do a comparison based on a column. Let's say, if column>5.

select * where column>5

The column contains non digits. I thought Oracle allows one to compare strings (like Java).

Apparently this is not allowed.

ORA-01722: invalid number
01722. 00000 -  "invalid number"

Is there a way to do comparisons with non numeric fields?
Thanks


Solution

  • Yes, you have to put the 5 in quotes :

    select * from table where column > '5'