以下是selection logic, 我写不出来,谁能帮帮我:
TABLE_A to TABLE_B mapping
Selection Criteria:
Select all from records from TABLE_A with max AS_OF_DATE and get the list of distinct PARENT_NUMBER with their KNE_NO’s.Match the PARENT_NUMBER with TABLE_B.PARENT_ACCOUNT_NO and SOURCE_SYSTEM_ID = TABLE_B.SOURCE_SYSTEM_ID .If match found then update with the following mappingIf a record in SSB_PARENT_ACCOUNT for PARENT_ACCOUNT_NO and SOURCE_SYSTEM_ID, does not find a match with the PARENT_NUMBER and SOURCE_SYSTEM , data from Selection criteria and also with GMBH_CUSTOMER_REF. PARENT_NUMBER then delete the record from SSB_PARENT_ACCOUNT
TABLE_A to TABLE_B mapping
Selection Criteria:
Select all from records from TABLE_A with max AS_OF_DATE and get the list of distinct PARENT_NUMBER with their KNE_NO’s.Match the PARENT_NUMBER with TABLE_B.PARENT_ACCOUNT_NO and SOURCE_SYSTEM_ID = TABLE_B.SOURCE_SYSTEM_ID .If match found then update with the following mappingIf a record in SSB_PARENT_ACCOUNT for PARENT_ACCOUNT_NO and SOURCE_SYSTEM_ID, does not find a match with the PARENT_NUMBER and SOURCE_SYSTEM , data from Selection criteria and also with GMBH_CUSTOMER_REF. PARENT_NUMBER then delete the record from SSB_PARENT_ACCOUNT
MERGE INTO products p
USING newproducts np
ON (p.product_id = np.product_id)
WHEN MATCHED THEN
UPDATE
SET p.product_name = np.product_name,
p.category = np.category
DELETE WHERE (p.category = 'ELECTRNCS')
WHEN NOT MATCHED THEN
INSERT
VALUES (np.product_id, np.product_name, np.category) ;