25.09.2015 Views

Teradata Parallel Data Pump

Teradata Parallel Data Pump Reference - Teradata Developer ...

Teradata Parallel Data Pump Reference - Teradata Developer ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 3: <strong>Teradata</strong> T<strong>Pump</strong> Commands<br />

UPDATE Statement and Atomic Upsert<br />

Example 9 (Valid Upsert UPDATE)<br />

This example demonstrates a successful upsert statement that updates a row.<br />

UPDATE Sales SET ItemCount = ItemCount + 1 WHERE (ItemNbr = 10 AND<br />

SaleDate = '05/30/2005') ELSE INSERT INTO Sales (10, '05/30/2005', 1);<br />

After all of the rules have been validated, the row with ItemNbr = 10 and SaleDate = '05/30/<br />

2005' gets updated. A successful update of one row results.<br />

Example 10 (Valid Upsert INSERT)<br />

This example demonstrates a successful upsert statement that inserts a row.<br />

UPDATE Sales SET ItemCount = ItemCount + 1 WHERE (ItemNbr = 20 AND<br />

SaleDate = '05/30/2005') ELSE INSERT INTO Sales (20, '05/30/2005', 1);<br />

After all of the rules have been validated and no row was found with Item = 20 and SaleDate =<br />

'05/30/2005' for the UPDATE, a new row is inserted with ItemNbr = 20. A successful insert of<br />

one row results.<br />

194 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!