0

I'm trying to add Oracle support to a tool designed to populate a schema for a given containerized database. The tool relies on a .sql script which is processed through ResourceDatabasePopulator.

The problem I'm facing is this well-established schema has several tables with columns named "KEY." I would love to simply fix the name of these columns but cannot do so.

The script itself escapes these column names well enough to run through sqlplus:

CREATE TABLE sys_config {
   ID NUMBER(19) not null,
   ...
   'KEY' varchar(255),
   PRIMARY KEY ID
);

However, when this DDL is processed, the following error occurs:

    [latest.sql]: create table sys_config ( ID number(19) not null, CFG_ID number(19), 'KEY' varchar2(255), VAL varchar2(255), primary key (ID) );
nested exception is java.sql.SQLSyntaxErrorException: ORA-00904: : invalid identifier

I've tried escaping the name in the following ways:

`KEY`
'`'KEY'`'
`'`KEY`'`
\'KEY\'

But keep running into either this "invalid identifier" error or an "invalid character" error.

Is there a way I can escape this column name that ResourceDatabasePopulator will support and still create these columns?

BrMcMullin
  • 1,261
  • 2
  • 12
  • 28

1 Answers1

0

Turns out this was more or less a duplicate of this issue here; it popped up on my question after I submitted it and I tried it on a whim. Ended up resolving the issue.

How do I escape a reserved word in Oracle?

BrMcMullin
  • 1,261
  • 2
  • 12
  • 28