I need to write a query on an Oracle database where one of the fields is called ACCOUNT
. ACCOUNT
is on the reserved list http://docs.oracle.com/cd/B19306_01/em.102/b40103/app_oracle_reserved_words.htm and my query is failing.
In this DB, ACCOUNT
is a VARCHAR2
and I cannot change it's name nor the structure of anything, I can only run SELECT
queries.
Although ACCOUNT
is a VARCHAR2
, it always contains an integer and I want to get at a range of values.
I thought that this would do the trick:
SELECT *
FROM TABLE
WHERE TO_NUMBER(ACCOUNT) > 1000
AND TO_NUMBER(ACCOUNT) < 2000
but I just get an ORA-01722 invalid number error.
I have checked that ACCOUNT
only contains integers and running this query with a non-reserved keyword works fine...