Example: MERGE Update Request When Target Table and Source Table Have Row-Level Security Constraints - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
Assume that:
  • The user logged onto this session has the OVERRIDE UPDATE CONSTRAINT row-level security privilege on table_1.
  • Both table_1 and table_2 have the same set of row-level security constraints.

The update of table_1 is valid and the database takes the constraint values for target table table_1, which are not specified in the request, from the constraint values defined for source table table_2.

     MERGE INTO table_1 AS target
     USING table_2 AS source
     ON (target.col_1 = source.col_1) 
     WHEN MATCHED THEN
     UPDATE SET level = source.col_2;