SQL Error [4856]:[Vertica][VJDBC](4856) ERROR: Syntax error at or near "#"

I am trying to make an exact DDL copy of a table from Oracle to Vertica. In Oracle schema I have a table  with the following DDL
create table TEST
(
id int,
name# varchar2(100),
city varchar2(100));

The Equivalent Vertica DDL is
create table TEST
(
id int,
name# varchar(100),
city varchar(100));

But when i create the table in Vertica, I get the following error message.
Error:SQL Error [4856] [HY000]: [Vertica][VJDBC](4856) ERROR: Syntax error at or near "#"
I do not see in SQLRefManual anything about column name constraints.
I cannot make changes to Column name as there will be conflict in mapping in ETL.
What can be the solution??

Comments

  • Hi,

    You can enclose column name in quotes (""). Quoted identifiers can contain any characters, including one which are not allowed/valid otherwise (in this case #).

    Following should work:

    create table TEST
    (
    id int,
    "name#" varchar(100),
    city varchar(100));

    You can read more about it in Vertica Doc:

    SQL Reference Manual --> SQL Language Elements --> Identifiers
    (https://my.vertica.com/docs/6.1.x/HTML/index.htm#8944.htm).

    Hope this helps.

    Thanks.
    Pravesh
  • Thanks a lot Pravesh!!
    I have implemented what you have suggested!!

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file