开发者

Got an Oracle Table Named as Reserved Word, Which problems may arise?

开发者 https://www.devze.com 2023-02-05 14:07 出处:网络
We just got a system outsourced and at first glance i can see some tables and fields with names as CASE or FROM. It is an Oracle 10g DB and we are going to be consuming those data from Java, Hibernate

We just got a system outsourced and at first glance i can see some tables and fields with names as CASE or FROM. It is an Oracle 10g DB and we are going to be consuming those data from Java, Hibernate, C#, C++.

Is there something special we should be aware of?

For what i've seen in other posts this is not recomm开发者_StackOverflowended because it will affect readability of our code, but is there any other, major or more serious problems this could cause?

Thanks!


To escape reserved words in Oracle, you need to enclose them (in this case, the table name) in double quotes. IE:

SELECT *
  FROM "CASE"

Otherwise, you'll get an "ORA-00903: Invalid table name" error. IIRC, Oracle treats text inside of double quotes as case sensitive so you can still get the error if the table name was created in lowercase when using the example query.

Other than that, I can only see the usual issue with poorly named entities/attributes.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号