Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

Syntax error at Vertica db on Table creation script

Hi, 

I'm trying to execute following script, but DB answers about syntax error near "(", I just can't find mistake :(, it don't even say which string is bad.

 

CREATE TABLE "AUTOTEST"."D2V_RT_ALL_TYPES_2"

("S_SMALLINT" INTEGER(8),
"S_INTEGER" INTEGER(8) NOT NULL,
"S_BIGINT" INTEGER,
"S_DECIMAL" NUMERIC(10, 2),
"S_REAL" FLOAT,
"S_DOUBLE" FLOAT,
"S_CHAR" CHAR(100),
"S_VARCHAR" VARCHAR(2000),
"S_CLOB" VARCHAR(65000),
"S_GRAPHIC" CHAR(400),
"S_VARGRAPHIC" VARCHAR(2000),
"S_DBCLOB" VARCHAR(65000),
"S_BLOB" VARBINARY(65000),
"S_DATE" DATE,
"S_TIME" TIME,
"S_TIMESTAMP" TIMESTAMP,
"S_LONG_VARCHAR" VARCHAR(65000),
"S_LONG_VARGRAPHIC" VARCHAR(32700),
PRIMARY KEY ("S_INTEGER")
)segmented BY hash ("S_INTEGER") all nodes

 

DBCException: SQL Error [4856] [42601]: [Vertica][VJDBC](4856) ERROR: Syntax error at or near "("
SQLException: [Vertica][VJDBC](4856) ERROR: Syntax error at or near "("
com.vertica.util.ServerException: ServerException: [Vertica][VJDBC](4856) ERROR: Syntax error at or near "("

Comments

  •  Hi,

     

    Remove the precision from your integer columns. you don`t need ot declare this.

     

    hope this will fix your issue.

     

     

    Tip:

    -when you get a crazy error like this, running it in a DbViz or any other gui will not point to the location of the error, he will treat it as a block.

    - to fix this run the sql at the vsql cmd line, this way you will get the exact column/sql that is failing :) 

  • Thanks a lot, it helped.

Leave a Comment

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

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.