1

I have a problem with sql ant taks with my build.xml. I use task in ant and creating a table with column name "rem" fails. I am guessing this is a reserved word in Oracle. However, I have two questions regarding this issue:

  1. This problem diesn't occur in sqlplus. i.e.: It lets me create a table with column name "rem".

  2. Should I be concerened about reserved words that aren't of Oracle. For example: "go" in mysql?

Thnak you.

user967710
  • 1,815
  • 3
  • 32
  • 58
  • 2
    Most implimentations of SQL alow you to wrap field names in quotes or back ticks. Then you can have almost any field name you like. But in general you should always avoid *all possible* reserved words / key words where possible. For no other reason than to avoid potential confusion by *people*, never mind by the *SQL Engine*. – MatBailie Mar 09 '12 at 13:54
  • 1
    Careful when wrapping column names, etc., in quotes in Oracle ... Oracle will allow you to create mixed-case names when wrapping in quotes (you can't do this w/o wrapping in quotes), and from then on you must use quotes when referring to those names. E.g., create table "xyzzy" - SELECT * FROM "xyzzy" – David Faber Mar 09 '12 at 13:58

2 Answers2

1

I don't think you need to worry about MySQL reserved words unless you are intending on using both RDBMS.

However, to address your second point first:

While cagcowboy's answer tells you how to fix the problem I can only ask that you do not do this.

I something has to be enclosed in double quotes then you have to remember to do that everywhere. Some UIs ( e.g. Toad ) require special options to be initialised.

Effectively it's a massive amount of hassle and as Dems and Davd Faber have commented can be massively confusing.

Incidentally go does seem to be a reserved work in Oracle, no idea what it does though.

To address your first bullet point rem isn't actually a reserved word in Oracle - only SQL*Plus- and creating a table with rem as a column name works because of this. Your specific problem must be a something to do with ant.

Community
  • 1
  • 1
Ben
  • 51,770
  • 36
  • 127
  • 149
0

Try putting the column in double quotes...

"REM"

cagcowboy
  • 30,012
  • 11
  • 69
  • 93