このプロシージャーは、Sources からデータを取得し、UPDATE (既存のエントリに対して) またはINSERT (新しいエントリに対して) オペレーションをターゲット テーブルに対して実行します。
Parameters
Parameter | Description |
|---|---|
| This parameter is obsolete. This is the target table, not necessarily in DWH. Use |
| Source object; mandatory |
| Columns that identify new and existing rows. |
| Set of columns that influence what will be updated |
| Parameter that decides whether all |
| Target table |
| How to calculate the surrogate key. Can have one of the following values:
|
| If |
| Redshift table creation options |
| Check field or expression in the |
| Default value if check field or expression variable is null |
If invertUpdateColumns is set to TRUE, key columns will be implicitly excluded from the columns to update. Nevertheless, you can never enumerate the same columns in keyColumnsArray and updateColumns.
Usage
CALL "UTILS.upsert"( "dwh_table" => 'string_dwh_table', "source_table" => 'string_source_table', "keyColumnsArray" => object_keyColumnsArray, "updateColumns" => object_updateColumns, "invertUpdateColumns" => boolean_invertUpdateColumns, "target_table" => 'string_target_table', "surrogateKeyType" => 'string_surrogateKeyType', "surrogateKeyName" => 'string_surrogateKeyName', "dbmsTableCreationOptions" => 'string_dbmsTableCreationOptions', "checkMaxField" => 'string_checkMaxField', "defaultvalueIfCheckMaxFieldIsNull" => 'string_defaultvalueIfCheckMaxFieldIsNull');;Example
CALL "UTILS.upsert" ( source_table => '"mssql.AdventureWorks.HumanResources.Employee"', keyColumnsArray => array ('EmployeeID'), updateColumns => array ('EmployeeID'), invertUpdateColumns => TRUE, target_table => '"oracle.employee"', surrogateKeyType => 'UUID', surrogateKeyName => 'SurrogateUUID', dbmsTableCreationOptions => NULL, checkMaxField => 'ModifiedDate', defaultvalueIfCheckMaxFieldIsNull => '''2000-01-01''' );;See Also
Using the Upsert Stored Procedure to Reproduce the SQL MERGE ソーステーブルからターゲットテーブルへのデータへの複数の挿入および更新を実行する方法については、こちらをご覧ください。