途中プッシュ
This commit is contained in:
parent
235130121e
commit
9c5ce1ef6c
@ -23,8 +23,17 @@ DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
|
||||
-- UPSERT STATEMENT設定
|
||||
SET @upsert_statement =
|
||||
'INSERT INTO ?.crm_Product_Metrics_vod__c (Id, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, MayEdit, IsLocked, LastViewedDate, LastReferencedDate, Account_vod__c, Awareness__c, Selling_Stage__c, Formulary_Status__c, Movement__c, Products_vod__c, Segment__c, X12_mo_trx_chg__c, Speaker_Skills__c, Investigator_Readiness__c, Engagements__c, Mobile_ID_vod__c, External_ID_vod__c, MSJ_Patient__c, Detail_Group_vod__c, MSJ_EB_1st_Line_Liver_Meta__c, MSJ_EB_1st_Line_Multi_Meta__c, MSJ_EB_2nd_Line_Mono__c, MSJ_EB_2nd_Line_Combination__c, MSJ_EB_3rd_Line_Mono__c, MSJ_EB_3rd_Line_Combination__c, EMDS_Ability__c, EMDS_Brand_Loyalty__c, EMDS_Decision_Maker__c, EMDS_Early_Tech_Adopter__c, EMDS_Influence__c, EMDS_Main_Driver__c, EMDS_Priority__c, EMDS_Willingness__c, MSJ_KTL_Type__c, MSJ_KTL_Tier__c, MSJ_Publications__c, MSJ_Clinical_Trials__c, MSJ_Speaker_for_Medical_Events__c, MSJ_Advisor_to_Medical_Affairs__c, MSJ_Guidelines_Treatment_Standards__c, MSJ_Therapeutic_Area_Expertise__c, MSJ_MAP_GAP__c, MSJ_Associations__c, MSJ_Tier_Score__c, medaca_parent_msj_product_classification__c, start_datetime, end_datetime, file_name, file_row_cnt, delete_flg, ins_user, ins_date, upd_user, upd_date)
|
||||
|
||||
'INSERT INTO $$distribution_schema$$.crm_Product_Metrics_vod__c (Id, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate,
|
||||
LastModifiedById, SystemModstamp, MayEdit, IsLocked, LastViewedDate, LastReferencedDate, Account_vod__c,
|
||||
Awareness__c, Selling_Stage__c, Formulary_Status__c, Movement__c, Products_vod__c, Segment__c, X12_mo_trx_chg__c,
|
||||
Speaker_Skills__c, Investigator_Readiness__c, Engagements__c, Mobile_ID_vod__c, External_ID_vod__c, MSJ_Patient__c,
|
||||
Detail_Group_vod__c, MSJ_EB_1st_Line_Liver_Meta__c, MSJ_EB_1st_Line_Multi_Meta__c, MSJ_EB_2nd_Line_Mono__c,
|
||||
MSJ_EB_2nd_Line_Combination__c, MSJ_EB_3rd_Line_Mono__c, MSJ_EB_3rd_Line_Combination__c, EMDS_Ability__c,
|
||||
EMDS_Brand_Loyalty__c, EMDS_Decision_Maker__c, EMDS_Early_Tech_Adopter__c, EMDS_Influence__c, EMDS_Main_Driver__c,
|
||||
EMDS_Priority__c, EMDS_Willingness__c, MSJ_KTL_Type__c, MSJ_KTL_Tier__c, MSJ_Publications__c, MSJ_Clinical_Trials__c,
|
||||
MSJ_Speaker_for_Medical_Events__c, MSJ_Advisor_to_Medical_Affairs__c, MSJ_Guidelines_Treatment_Standards__c,
|
||||
MSJ_Therapeutic_Area_Expertise__c, MSJ_MAP_GAP__c, MSJ_Associations__c, MSJ_Tier_Score__c, start_datetime,
|
||||
end_datetime, file_name, file_row_cnt, delete_flg, ins_user, ins_date, upd_user, upd_date)
|
||||
SELECT
|
||||
Id, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp,
|
||||
MayEdit, IsLocked, LastViewedDate, LastReferencedDate, Account_vod__c, Awareness__c, Selling_Stage__c,
|
||||
@ -36,13 +45,12 @@ SET @upsert_statement =
|
||||
EMDS_Main_Driver__c, EMDS_Priority__c, EMDS_Willingness__c, MSJ_KTL_Type__c, MSJ_KTL_Tier__c,
|
||||
MSJ_Publications__c, MSJ_Clinical_Trials__c, MSJ_Speaker_for_Medical_Events__c,
|
||||
MSJ_Advisor_to_Medical_Affairs__c, MSJ_Guidelines_Treatment_Standards__c, MSJ_Therapeutic_Area_Expertise__c,
|
||||
MSJ_MAP_GAP__c, MSJ_Associations__c, MSJ_Tier_Score__c, medaca_parent_msj_product_classification__c,
|
||||
start_datetime, end_datetime, file_name, file_row_cnt, delete_flg, ins_user, ins_date, upd_user, upd_date
|
||||
MSJ_MAP_GAP__c, MSJ_Associations__c, MSJ_Tier_Score__c, start_datetime, end_datetime, file_name, file_row_cnt,
|
||||
delete_flg, ins_user, ins_date, upd_user, upd_date
|
||||
FROM
|
||||
internal02.crm_Product_Metrics_vod__c AS internaltb
|
||||
WHERE
|
||||
Id = ?
|
||||
|
||||
Id = $$temp_table_id$$
|
||||
ON DUPLICATE KEY UPDATE
|
||||
IsDeleted = internaltb.IsDeleted, Name = internaltb.Name, CreatedDate = internaltb.CreatedDate,
|
||||
CreatedById = internaltb.CreatedById, LastModifiedDate = internaltb.LastModifiedDate,
|
||||
@ -75,7 +83,6 @@ SET @upsert_statement =
|
||||
MSJ_Therapeutic_Area_Expertise__c = internaltb.MSJ_Therapeutic_Area_Expertise__c,
|
||||
MSJ_MAP_GAP__c = internaltb.MSJ_MAP_GAP__c, MSJ_Associations__c = internaltb.MSJ_Associations__c,
|
||||
MSJ_Tier_Score__c = internaltb.MSJ_Tier_Score__c,
|
||||
medaca_parent_msj_product_classification__c = internaltb.medaca_parent_msj_product_classification__c,
|
||||
start_datetime = internaltb.start_datetime, end_datetime = internaltb.end_datetime,
|
||||
file_name = internaltb.file_name, file_row_cnt = internaltb.file_row_cnt,
|
||||
upd_user = CURRENT_USER(), upd_date = CURRENT_TIMESTAMP();';
|
||||
@ -93,12 +100,15 @@ TableCursorLoop: LOOP
|
||||
LEAVE TableCursorLoop;
|
||||
END IF;
|
||||
|
||||
SET @distribution_schema = get_distribution_to_schema(crm_Product_Metrics_vod__c, medaca_parent_msj_product_classification__c, target_column_value);
|
||||
SET @distribution_schema = get_distribution_to_schema('crm_Product_Metrics_vod__c', 'medaca_parent_msj_product_classification__c', target_column_value);
|
||||
SET @temp_table_id = temp_table_id;
|
||||
|
||||
SET @upsert_statement = REPLACE(@upsert_statement, "$$distribution_schema$$", @distribution_schema);
|
||||
SET @upsert_statement = REPLACE(@upsert_statement, "$$temp_table_id$$", @temp_table_id);
|
||||
|
||||
-- UPSERT実行
|
||||
PREPARE stmt FROM @upsert_statement;
|
||||
EXECUTE stmt USING @distribution_schema, @temp_table_id;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
END LOOP;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user