I’m trying to troubleshoot an issue with some code that my boss wrote.
Before I begin, let me say that I already know that it’s not a good idea to use reserved words as column names. The boss did this prior to my involvement. And, honestly, it hasn’t been an issue anywhere else in this project.
Here is the table layout:
UUID VARCHAR(36)
HOSTNAME VARCHAR(100)
DATE DATE
PAGEVIEWS NUMBER
VISITORS NUMBER
I’ve tried surrounding the reserved word “date” with double-quotes, as per Oracle documentation. The error message I get back while trying to INSERT a date is “date” : invalid identifier.
Is there a way to fix this without changing the column name?
Did some research on this, and apparently there isn’t too much of a problem naming a column “date” as long as the column isn’t a ‘DATE’ datatype. But a ‘DATE’ column named “date” will cause the compiler to choke.
So… the ONLY fix for this was to rename the column. Thankfully, there was only the one query, so far, that was accessing that schema/table.
I’ll keep this post here, in case someone else runs into the same problem.
Eeeeyup… didn’t work. I found a post somewhere (wish I had kept the URL) where someone indicated that a DATE column named “date” or “Date” or “DATE” (or any other case-combo) will cause the compiler to choke. I guess you could name a NUMBER column “date” and not have a problem; but a DATE column will have a problem.