TDV Adapter for Apache HBase

Build 21.0.8137

UPSERT Statements

An UPSERT statement updates an existing record or creates a new record if an existing record is not identified.


The UPSERT syntax is the same as for insert. HBase uses the input provided in the VALUES clause to determine whether the record already exists. If the record does not exist, all columns required to insert the record must be specified. See Data Model for any table-specific information.

UPSERT INTO <table_name> 
( <column_reference> [ , ... ] )
( { <expression> | NULL } [ , ... ] ) 

<expression> ::=
  | @ <parameter> 
  | ?
  | <literal>
You can use the executeUpdate method of the Statement and PreparedStatement classes to issue data manipulation commands and retrieve the rows affected, as shown in the following example:
String cmd = "UPSERT INTO Account (Name) VALUES (?)";
PreparedStatement pstmt = connection.prepareStatement(cmd);
pstmt.setString(1, "Floppy Disks");
int count = pstmt.executeUpdate();
System.out.println(count+" rows were affected");

Copyright (c) 2022 CData Software, Inc. - All rights reserved.
Build 21.0.8137