theGecko
theGecko

Reputation: 1021

Reserved words in NHibernate

I need to reference a column called limit in a legacy oracle database and also use a SQLite in-memory database for unit testing. I have read to use backticks in the mapping files to accomplish this; limit which works fine in SQLite, but resolves to "limit" in oracle and barfs on the query.

Is this feature implemented correctly for oracle or am I missing something?

Cheers,

Rob

UPDATE

It seems the column wasn't created with quotes around it, but NHibernate recognises it as reserved and puts quotes round it :/

Upvotes: 1

Views: 1044

Answers (1)

Vincent Malgrat
Vincent Malgrat

Reputation: 67722

In Oracle you use double-quotes to reference objects with names as reserved words:

SQL> create table a (number number);

create table a (number number)
                ^
ORA-00904: : invalid identifier

"NUMBER" is a reserved word. However, you can:

SQL> create table a ("number" number);

Table created

SQL> select "number" from a;

    number
----------

Upvotes: 2

Related Questions