Search code examples
sqlderby

sql Error in derby - ERROR 42X01: Syntax error: Encountered "KEY"


following query gives error like ERROR 42X01: Syntax error: Encountered "KEY" at line 1, column 48.

I am not able to understand what is the exact issue. column KEY is exist and datatype is integer.

Insert into UOM_TYPE 
(UNITS_OF_MEASURE_NO,TYPE,KEY,CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE,VERSION)
values 
(79,'Clinical Property',32,'JRL',DATE('2007-05-04'),'JRL',DATE('2007-05-04'),2);

Please help me to resolve the issue


Solution

  • KEY is a Keyword in derby db. you have to escape it :

    Insert into UOM_TYPE 
    (UNITS_OF_MEASURE_NO,TYPE,"KEY",CREATED_BY,CREATED_DATE,MODIFIED_BY,MODIFIED_DATE,VERSION)
    values 
    (79,'Clinical Property',32,'JRL',DATE('2007-05-04'),'JRL',DATE('2007-05-04'),2);