Tarea hormiga sql versus sqlplus: palabra de reserva "rem"

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?


preguntado el 09 de marzo de 12 a las 13:03

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 todo posible reserved words / key words where possible. For no other reason than to avoid potential confusion by personas, never mind by the Motor SQL. -

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" -

2 Respuestas

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:

Aunque la la respuesta de cagcowboy tells you how to fix the problem I can only ask that you no hagas esto.

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 y Davd Faber have commented can be massively confusing.

De paso 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 - , solamente 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.

contestado el 23 de mayo de 17 a las 13:05

Try putting the column in double quotes...


respondido 09 mar '12, 13:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.