Example: Using StmtDMLRowCount - 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

This example shows how to use the StmtDMLRowCount column to see the number of rows inserted, updated, or deleted for DML statements.

Run a multiple-statement request, such as:

INSERT INTO T3(1, 'abc', 'def')
; INSERT INTO T3(1, 'ghi', 'jkl')
; MERGE INTO T3 AS t USING 
(SELECT 1 AS a,'stf' AS b,'xyz' AS c)  AS s on t.a = s.a
WHEN MATCHED THEN UPDATE SET c = s.c
WHEN NOT MATCHED THEN INSERT VALUES (s.a,s.b,s.c)
; MERGE INTO T3 AS t USING 
(SELECT 1 AS a,'stf' AS b,'xyz' AS c)  AS s on t.a = s.a
WHEN MATCHED THEN UPDATE SET c = s.c
WHEN NOT MATCHED THEN INSERT VALUES (s.a,s.b,s.c)
; DELETE FROM T3;

The multiple-statement request inserted 2 rows to table T3, updated 4 rows in table T3, and deleted 2 rows from table T3:

SELECT StmtDMLRowCount FROM DBC.QryLogV;

Result:

StmtDMLRowCount 
---------------------------------------
{"Insert":2,"Update":4,"Delete":2}