UPDATE

Function

Update specified data in an HStore table.

Precautions

Syntax

1
2
3
4
UPDATE [/*+ plan_hint */] [ ONLY ] table_name [ * ] [ [ AS ] alias ]
SET {column_name = { expression | DEFAULT } 
    |( column_name [, ...] ) = {( { expression | DEFAULT } [, ...] ) |sub_query }}[, ...]
    [ FROM from_list] [ WHERE condition ];

Parameters

Example

Create the reason_update table.
1
2
3
4
5
6
CREATE TABLE reason_update
(
    TABLE_SK          INTEGER               ,
    TABLE_ID          VARCHAR(20)           ,
    TABLE_NA          VARCHAR(20)
)WITH(ORIENTATION=COLUMN, ENABLE_HSTORE=ON);
Insert data to the reason_update table.
1
INSERT INTO reason_update VALUES (1, 'S01', 'StudentA'),(2, 'T01', 'TeacherA'),(3, 'T02', 'TeacherB');
Perform the UPDATE operation on the reason_update table.
1
UPDATE reason_update SET TABLE_NA = 'TeacherD' where TABLE_SK = 3;