0

I want to update a table named EMPLOYEE in hbase, which looks like the following and the row key is ID.

ID,Name,Age
"1","John","34"
"2","David","22"

I want to add another column named City in this table. Using Apache phoenix I executed this command first to alter the existing schema.

ALTER TABLE "EMPLOYEE" ADD IF NOT EXISTS "CITY" VARCHAR(40)

This command executed successfully. Then I tried to insert values. Using the following command.

UPSERT INTO "EMPLOYEE" ("ID","CITY") VALUES ("1", "London")

However every time I execute this, I get the following error -

Exception in thread "main" java.sql.SQLException: ERROR 204 (22008): Values in UPSERT must evaluate to a constant.

What is it what I am missing here, that is causing the error.

userxxx
  • 796
  • 10
  • 18

2 Answers2

6

I figured out what was causing the error, Changing double quotes to single quotes worked for me -

UPSERT INTO "EMPLOYEE" ("ID","CITY") VALUES ('1', 'London')
userxxx
  • 796
  • 10
  • 18
0

String literal values should be in single quotations, '.

kliew
  • 3,073
  • 1
  • 14
  • 25