diff --git a/dev/workflow/TK_Cust/tk_crm/CRM销售机会/t01_crm_opportunity_agi.sql b/dev/workflow/TK_Cust/tk_crm/CRM销售机会/t01_crm_opportunity_agi.sql index 9ab7e0f..18b5efb 100644 --- a/dev/workflow/TK_Cust/tk_crm/CRM销售机会/t01_crm_opportunity_agi.sql +++ b/dev/workflow/TK_Cust/tk_crm/CRM销售机会/t01_crm_opportunity_agi.sql @@ -4,7 +4,7 @@ /*Brilliance stems from wisdoms. */ /*************Head Section**************************************************************************/ /*Script Use: Periodically load data to :t01_crm_opportunity(CRM销售机会) */ -/*Create Date:2024-04-19 15:27:22 */ +/*Create Date:2024-04-19 16:39:32 */ /*SDM Developed By: dev */ /*SDM Developed Date: 2024-04-19 */ /*SDM Checked By: dev */ @@ -121,7 +121,7 @@ SELECT ,COALESCE(TRIM(CAST(p0.tek_productidname AS varchar(50))),'') /*product_name*/ ,COALESCE(TRIM(CAST(p0.tek_productfamilyidname AS varchar(50))),'') /*product_class*/ ,COALESCE(TRIM(CAST(p0.transactioncurrencyidname AS varchar(20))),'') /*currency_name*/ - ,COALESCE(CAST(p0.tek_unitpricetotal_base AS int),0) /*uint_price*/ + ,COALESCE(CAST(p0.tek_unitpricetotal_base::numeric(12,4) AS int),0) /*uint_price*/ ,COALESCE(CAST(p0.tek_totaldiscountpercent AS numeric(12,4)),0) /*discount_percent*/ ,COALESCE(CAST(p0.totaldiscountamount_base AS numeric(16,4)),0) /*discount_amount_base*/ ,COALESCE(CAST(p0.estimatedvalue_base AS numeric(16,4)),0) /*base_amount*/ @@ -135,7 +135,7 @@ SELECT ,COALESCE(TRIM(CAST(p0.tek_oppterritoryidname AS varchar(50))),'') /*territory_id*/ ,COALESCE(TRIM(CAST(p0.tek_opp_includeinforecastname AS varchar(10))),'') /*forecast_opp_ind*/ ,COALESCE(TRIM(CAST(p0.tek_isriskname AS varchar(10))),'') /*risk_ind*/ - ,COALESCE(CAST(p0.tek_opportunityage AS int),0) /*opportunity_age*/ + ,COALESCE(CAST(p0.TEK_OPPORTUNITYAGE::numeric(12,4) AS int),0) /*opportunity_age*/ ,COALESCE(TO_TIMESTAMP(CAST(p0.createdon AS VARCHAR(19)),'YYYY-MM-DD HH24:mi:ss'),TO_TIMESTAMP(:NULLDATE,'YYYYMMDD')) /*create_time*/ ,COALESCE(TRIM(CAST(p0.createdbyname AS varchar(50))),'') /*create_person*/ ,COALESCE(TO_TIMESTAMP(CAST(p0.tek_piplinelastupdatedon AS VARCHAR(19)),'YYYY-MM-DD HH24:mi:ss'),TO_TIMESTAMP(:NULLDATE,'YYYYMMDD')) /*pipline_last_update*/ @@ -161,8 +161,8 @@ SELECT ,COALESCE(TRIM(CAST(p0.tek_marketing_program_type_idname AS varchar(100))),'') /*marketing_program_type*/ ,COALESCE(TRIM(CAST(p0.tek_leadnumber AS varchar(20))),'') /*lead_number*/ ,COALESCE(TRIM(CAST(p0.tek_contactnumber AS varchar(20))),'') /*crm_contact_number*/ - ,TO_DATE(:TXDATE,'YYYYMMDD') /*Scd_Start_Dt*/ - ,TO_DATE(:MAXDATE,'YYYYMMDD') /*Scd_End_Dt*/ + ,TO_DATE(:TXDATE,'YYYYMMDD') /*Scd_Start_Dt*/ + ,TO_DATE(:MAXDATE,'YYYYMMDD') /*Scd_End_Dt*/ ,0 /*Etl_Batch_No*/ ,TO_DATE(:TXDATE,'YYYYMMDD') /*Etl_First_Dt*/ ,:ETLJOB /*Etl_Job*/ @@ -189,51 +189,51 @@ AND scd_End_Dt=TO_DATE(:TXDATE,'YYYYMMDD'); /*往临时表插入当前数据。 */ INSERT INTO t01_crm_opportunity_agi_CUR( - tek_opportunitynumber /*tek_opportunitynumber*/ - ,tek_unitpricetotal_base /*tek_unitpricetotal_base*/ - ,tek_totaldiscountpercent /*tek_totaldiscountpercent*/ - ,totaldiscountamount_base /*totaldiscountamount_base*/ - ,estimatedvalue_base /*estimatedvalue_base*/ - ,totalamount /*totalamount*/ - ,tek_salesfunnelstagename /*tek_salesfunnelstagename*/ - ,tek_funnelstagenumber /*tek_funnelstagenumber*/ - ,statuscodename /*statuscodename*/ - ,statecodename /*statecodename*/ - ,tek_regionidname /*tek_regionidname*/ - ,name /*name*/ - ,tek_accountmanageridname /*tek_accountmanageridname*/ - ,tek_oppterritoryidname /*tek_oppterritoryidname*/ - ,tek_opp_includeinforecastname /*tek_opp_includeinforecastname*/ - ,tek_isriskname /*tek_isriskname*/ - ,tek_opportunityage /*tek_opportunityage*/ - ,createdon /*createdon*/ - ,createdbyname /*createdbyname*/ - ,tek_piplinelastupdatedon /*tek_piplinelastupdatedon*/ - ,tek_laststatusdate /*tek_laststatusdate*/ - ,tek_channelidname /*tek_channelidname*/ - ,tek_tektronixapname /*tek_tektronixapname*/ - ,tek_purchasemethodname /*tek_purchasemethodname*/ - ,campaignidname /*campaignidname*/ - ,tek_webvisitormedium /*tek_webvisitormedium*/ - ,tek_webvisitorsource /*tek_webvisitorsource*/ - ,tek_customerapplication /*tek_customerapplication*/ - ,tek_vertical_segmentname /*tek_vertical_segmentname*/ - ,tek_competitivestatusname /*tek_competitivestatusname*/ - ,tek_importantopportunityname /*tek_importantopportunityname*/ - ,tek_applicationidname /*tek_applicationidname*/ - ,tek_industryidname /*tek_industryidname*/ - ,estimatedclosedate /*estimatedclosedate*/ - ,tek_taglist /*tek_taglist*/ - ,discountamount /*discountamount*/ - ,tek_terr_areaidname /*tek_terr_areaidname*/ - ,tek_terr_branchidname /*tek_terr_branchidname*/ - ,tek_extension /*tek_extension*/ - ,tek_companynamelegal /*tek_companynamelegal*/ - ,accountnumber /*accountnumber*/ - ,tek_marketing_program_type_idname /*tek_marketing_program_type_idname*/ - ,tek_leadnumber /*tek_leadnumber*/ - ,tek_contactnumber /*tek_contactnumber*/ - ,parentaccountidname /*parentaccountidname*/ + tek_opportunity_id /*泰克机会编号*/ + ,uint_price /*单价*/ + ,discount_percent /*折扣率*/ + ,discount_amount_base /*基础折扣金额*/ + ,base_amount /*基础金额*/ + ,total_amount /*总金额*/ + ,sales_funnel_stage /*销售漏斗层级*/ + ,sales_funnel_stage_id /*销售漏斗层级编号*/ + ,status /*状况*/ + ,state /*状态*/ + ,region /*区域*/ + ,opportunity_name /*机会名称*/ + ,acount_manager /*账号经理*/ + ,territory_id /*领域编号*/ + ,forecast_opp_ind /*预期机会标志*/ + ,risk_ind /*风险标志*/ + ,opportunity_age /*机会年份*/ + ,create_time /*创建时间*/ + ,create_person /*创建人*/ + ,pipline_last_update /*pipline最后更新时间*/ + ,status_last_update /*状况最后更新时间*/ + ,channel_id /*渠道编号*/ + ,tektronix_apname /*tek_tektronixapname*/ + ,purchase_method /*采购方式*/ + ,campaign_name /*活动名称*/ + ,web_medium /*网络媒介*/ + ,web_source /*网络来源*/ + ,customer_app /*客户应用*/ + ,vertical_segment /*垂直领域*/ + ,competitive_status /*竞争状态*/ + ,important_opportunity_ind /*重要机会标志*/ + ,application_name /*应用名称*/ + ,opp_industry /*行业(opp)*/ + ,estimated_close_time /*预期关闭时间*/ + ,tag_list /*标签列表*/ + ,discount_amount /*折扣金额*/ + ,area_id /*地区编号*/ + ,branch_id /*分支编号*/ + ,extension_id /*扩展编号*/ + ,legal_company_name /*法定公司名称*/ + ,account_number /*账号编号*/ + ,marketing_program_type /*市场项目类型*/ + ,lead_number /*线索编号*/ + ,crm_contact_number /*联系人编号*/ + ,parent_account_name /*父账号名称*/ ,Scd_Start_Dt /*开始时间*/ ,Scd_End_Dt /*结束时间*/ ,Etl_Batch_No /*作业批次号*/ @@ -243,57 +243,57 @@ INSERT INTO t01_crm_opportunity_agi_CUR( ,Etl_Tx_Dt /*作业运行时间*/ ,Src_Sysname /*来源系统*/ ,Src_Table /*来源表*/ - ,parentcontactidname /*parentcontactidname*/ - ,tek_productidname /*tek_productidname*/ - ,tek_productfamilyidname /*tek_productfamilyidname*/ - ,transactioncurrencyidname /*transactioncurrencyidname*/ + ,parent_contact_name /*父联系人名称*/ + ,product_name /*产品名称*/ + ,product_class /*产品类别*/ + ,currency_name /*交易币种*/ ) SELECT - P1.tek_opportunitynumber /*tek_opportunitynumber*/ - ,P1.tek_unitpricetotal_base /*tek_unitpricetotal_base*/ - ,P1.tek_totaldiscountpercent /*tek_totaldiscountpercent*/ - ,P1.totaldiscountamount_base /*totaldiscountamount_base*/ - ,P1.estimatedvalue_base /*estimatedvalue_base*/ - ,P1.totalamount /*totalamount*/ - ,P1.tek_salesfunnelstagename /*tek_salesfunnelstagename*/ - ,P1.tek_funnelstagenumber /*tek_funnelstagenumber*/ - ,P1.statuscodename /*statuscodename*/ - ,P1.statecodename /*statecodename*/ - ,P1.tek_regionidname /*tek_regionidname*/ - ,P1.name /*name*/ - ,P1.tek_accountmanageridname /*tek_accountmanageridname*/ - ,P1.tek_oppterritoryidname /*tek_oppterritoryidname*/ - ,P1.tek_opp_includeinforecastname /*tek_opp_includeinforecastname*/ - ,P1.tek_isriskname /*tek_isriskname*/ - ,P1.tek_opportunityage /*tek_opportunityage*/ - ,P1.createdon /*createdon*/ - ,P1.createdbyname /*createdbyname*/ - ,P1.tek_piplinelastupdatedon /*tek_piplinelastupdatedon*/ - ,P1.tek_laststatusdate /*tek_laststatusdate*/ - ,P1.tek_channelidname /*tek_channelidname*/ - ,P1.tek_tektronixapname /*tek_tektronixapname*/ - ,P1.tek_purchasemethodname /*tek_purchasemethodname*/ - ,P1.campaignidname /*campaignidname*/ - ,P1.tek_webvisitormedium /*tek_webvisitormedium*/ - ,P1.tek_webvisitorsource /*tek_webvisitorsource*/ - ,P1.tek_customerapplication /*tek_customerapplication*/ - ,P1.tek_vertical_segmentname /*tek_vertical_segmentname*/ - ,P1.tek_competitivestatusname /*tek_competitivestatusname*/ - ,P1.tek_importantopportunityname /*tek_importantopportunityname*/ - ,P1.tek_applicationidname /*tek_applicationidname*/ - ,P1.tek_industryidname /*tek_industryidname*/ - ,P1.estimatedclosedate /*estimatedclosedate*/ - ,P1.tek_taglist /*tek_taglist*/ - ,P1.discountamount /*discountamount*/ - ,P1.tek_terr_areaidname /*tek_terr_areaidname*/ - ,P1.tek_terr_branchidname /*tek_terr_branchidname*/ - ,P1.tek_extension /*tek_extension*/ - ,P1.tek_companynamelegal /*tek_companynamelegal*/ - ,P1.accountnumber /*accountnumber*/ - ,P1.tek_marketing_program_type_idname /*tek_marketing_program_type_idname*/ - ,P1.tek_leadnumber /*tek_leadnumber*/ - ,P1.tek_contactnumber /*tek_contactnumber*/ - ,P1.parentaccountidname /*parentaccountidname*/ + P1.tek_opportunity_id /*泰克机会编号*/ + ,P1.uint_price /*单价*/ + ,P1.discount_percent /*折扣率*/ + ,P1.discount_amount_base /*基础折扣金额*/ + ,P1.base_amount /*基础金额*/ + ,P1.total_amount /*总金额*/ + ,P1.sales_funnel_stage /*销售漏斗层级*/ + ,P1.sales_funnel_stage_id /*销售漏斗层级编号*/ + ,P1.status /*状况*/ + ,P1.state /*状态*/ + ,P1.region /*区域*/ + ,P1.opportunity_name /*机会名称*/ + ,P1.acount_manager /*账号经理*/ + ,P1.territory_id /*领域编号*/ + ,P1.forecast_opp_ind /*预期机会标志*/ + ,P1.risk_ind /*风险标志*/ + ,P1.opportunity_age /*机会年份*/ + ,P1.create_time /*创建时间*/ + ,P1.create_person /*创建人*/ + ,P1.pipline_last_update /*pipline最后更新时间*/ + ,P1.status_last_update /*状况最后更新时间*/ + ,P1.channel_id /*渠道编号*/ + ,P1.tektronix_apname /*tek_tektronixapname*/ + ,P1.purchase_method /*采购方式*/ + ,P1.campaign_name /*活动名称*/ + ,P1.web_medium /*网络媒介*/ + ,P1.web_source /*网络来源*/ + ,P1.customer_app /*客户应用*/ + ,P1.vertical_segment /*垂直领域*/ + ,P1.competitive_status /*竞争状态*/ + ,P1.important_opportunity_ind /*重要机会标志*/ + ,P1.application_name /*应用名称*/ + ,P1.opp_industry /*行业(opp)*/ + ,P1.estimated_close_time /*预期关闭时间*/ + ,P1.tag_list /*标签列表*/ + ,P1.discount_amount /*折扣金额*/ + ,P1.area_id /*地区编号*/ + ,P1.branch_id /*分支编号*/ + ,P1.extension_id /*扩展编号*/ + ,P1.legal_company_name /*法定公司名称*/ + ,P1.account_number /*账号编号*/ + ,P1.marketing_program_type /*市场项目类型*/ + ,P1.lead_number /*线索编号*/ + ,P1.crm_contact_number /*联系人编号*/ + ,P1.parent_account_name /*父账号名称*/ ,P1.Scd_Start_Dt /*开始时间*/ ,P1.Scd_End_Dt /*结束时间*/ ,P1.Etl_Batch_No /*作业批次号*/ @@ -303,10 +303,10 @@ SELECT ,P1.Etl_Tx_Dt /*作业运行时间*/ ,P1.Src_Sysname /*来源系统*/ ,P1.Src_Table /*来源表*/ - ,P1.parentcontactidname /*parentcontactidname*/ - ,P1.tek_productidname /*tek_productidname*/ - ,P1.tek_productfamilyidname /*tek_productfamilyidname*/ - ,P1.transactioncurrencyidname /*transactioncurrencyidname*/ + ,P1.parent_contact_name /*父联系人名称*/ + ,P1.product_name /*产品名称*/ + ,P1.product_class /*产品类别*/ + ,P1.currency_name /*交易币种*/ FROM :PDMDB.t01_crm_opportunity P1 WHERE P1.Scd_End_Dt = TO_DATE(:MAXDATE,'YYYYMMDD') @@ -315,51 +315,51 @@ WHERE P1.Scd_End_Dt = TO_DATE(:MAXDATE,'YYYYMMDD') /*"今日数据"与"当前有效数据"进行比较找出新增及更新的数据,比对条件是:除去开始日期和结束日期的所有 */ /*字段。 */ INSERT INTO t01_crm_opportunity_agi_INS( - tek_opportunitynumber /*tek_opportunitynumber*/ - , tek_unitpricetotal_base /*tek_unitpricetotal_base*/ - , tek_totaldiscountpercent /*tek_totaldiscountpercent*/ - , totaldiscountamount_base /*totaldiscountamount_base*/ - , estimatedvalue_base /*estimatedvalue_base*/ - , totalamount /*totalamount*/ - , tek_salesfunnelstagename /*tek_salesfunnelstagename*/ - , tek_funnelstagenumber /*tek_funnelstagenumber*/ - , statuscodename /*statuscodename*/ - , statecodename /*statecodename*/ - , tek_regionidname /*tek_regionidname*/ - , name /*name*/ - , tek_accountmanageridname /*tek_accountmanageridname*/ - , tek_oppterritoryidname /*tek_oppterritoryidname*/ - , tek_opp_includeinforecastname /*tek_opp_includeinforecastname*/ - , tek_isriskname /*tek_isriskname*/ - , tek_opportunityage /*tek_opportunityage*/ - , createdon /*createdon*/ - , createdbyname /*createdbyname*/ - , tek_piplinelastupdatedon /*tek_piplinelastupdatedon*/ - , tek_laststatusdate /*tek_laststatusdate*/ - , tek_channelidname /*tek_channelidname*/ - , tek_tektronixapname /*tek_tektronixapname*/ - , tek_purchasemethodname /*tek_purchasemethodname*/ - , campaignidname /*campaignidname*/ - , tek_webvisitormedium /*tek_webvisitormedium*/ - , tek_webvisitorsource /*tek_webvisitorsource*/ - , tek_customerapplication /*tek_customerapplication*/ - , tek_vertical_segmentname /*tek_vertical_segmentname*/ - , tek_competitivestatusname /*tek_competitivestatusname*/ - , tek_importantopportunityname /*tek_importantopportunityname*/ - , tek_applicationidname /*tek_applicationidname*/ - , tek_industryidname /*tek_industryidname*/ - , estimatedclosedate /*estimatedclosedate*/ - , tek_taglist /*tek_taglist*/ - , discountamount /*discountamount*/ - , tek_terr_areaidname /*tek_terr_areaidname*/ - , tek_terr_branchidname /*tek_terr_branchidname*/ - , tek_extension /*tek_extension*/ - , tek_companynamelegal /*tek_companynamelegal*/ - , accountnumber /*accountnumber*/ - , tek_marketing_program_type_idname /*tek_marketing_program_type_idname*/ - , tek_leadnumber /*tek_leadnumber*/ - , tek_contactnumber /*tek_contactnumber*/ - , parentaccountidname /*parentaccountidname*/ + tek_opportunity_id /*泰克机会编号*/ + , uint_price /*单价*/ + , discount_percent /*折扣率*/ + , discount_amount_base /*基础折扣金额*/ + , base_amount /*基础金额*/ + , total_amount /*总金额*/ + , sales_funnel_stage /*销售漏斗层级*/ + , sales_funnel_stage_id /*销售漏斗层级编号*/ + , status /*状况*/ + , state /*状态*/ + , region /*区域*/ + , opportunity_name /*机会名称*/ + , acount_manager /*账号经理*/ + , territory_id /*领域编号*/ + , forecast_opp_ind /*预期机会标志*/ + , risk_ind /*风险标志*/ + , opportunity_age /*机会年份*/ + , create_time /*创建时间*/ + , create_person /*创建人*/ + , pipline_last_update /*pipline最后更新时间*/ + , status_last_update /*状况最后更新时间*/ + , channel_id /*渠道编号*/ + , tektronix_apname /*tek_tektronixapname*/ + , purchase_method /*采购方式*/ + , campaign_name /*活动名称*/ + , web_medium /*网络媒介*/ + , web_source /*网络来源*/ + , customer_app /*客户应用*/ + , vertical_segment /*垂直领域*/ + , competitive_status /*竞争状态*/ + , important_opportunity_ind /*重要机会标志*/ + , application_name /*应用名称*/ + , opp_industry /*行业(opp)*/ + , estimated_close_time /*预期关闭时间*/ + , tag_list /*标签列表*/ + , discount_amount /*折扣金额*/ + , area_id /*地区编号*/ + , branch_id /*分支编号*/ + , extension_id /*扩展编号*/ + , legal_company_name /*法定公司名称*/ + , account_number /*账号编号*/ + , marketing_program_type /*市场项目类型*/ + , lead_number /*线索编号*/ + , crm_contact_number /*联系人编号*/ + , parent_account_name /*父账号名称*/ , Scd_Start_Dt /*开始时间*/ , Scd_End_Dt /*结束时间*/ , Etl_Batch_No /*作业批次号*/ @@ -369,57 +369,57 @@ INSERT INTO t01_crm_opportunity_agi_INS( , Etl_Tx_Dt /*作业运行时间*/ , Src_Sysname /*来源系统*/ , Src_Table /*来源表*/ - , parentcontactidname /*parentcontactidname*/ - , tek_productidname /*tek_productidname*/ - , tek_productfamilyidname /*tek_productfamilyidname*/ - , transactioncurrencyidname /*transactioncurrencyidname*/ + , parent_contact_name /*父联系人名称*/ + , product_name /*产品名称*/ + , product_class /*产品类别*/ + , currency_name /*交易币种*/ ) SELECT - P1.tek_opportunitynumber /*tek_opportunitynumber*/ - , P1.tek_unitpricetotal_base /*tek_unitpricetotal_base*/ - , P1.tek_totaldiscountpercent /*tek_totaldiscountpercent*/ - , P1.totaldiscountamount_base /*totaldiscountamount_base*/ - , P1.estimatedvalue_base /*estimatedvalue_base*/ - , P1.totalamount /*totalamount*/ - , P1.tek_salesfunnelstagename /*tek_salesfunnelstagename*/ - , P1.tek_funnelstagenumber /*tek_funnelstagenumber*/ - , P1.statuscodename /*statuscodename*/ - , P1.statecodename /*statecodename*/ - , P1.tek_regionidname /*tek_regionidname*/ - , P1.name /*name*/ - , P1.tek_accountmanageridname /*tek_accountmanageridname*/ - , P1.tek_oppterritoryidname /*tek_oppterritoryidname*/ - , P1.tek_opp_includeinforecastname /*tek_opp_includeinforecastname*/ - , P1.tek_isriskname /*tek_isriskname*/ - , P1.tek_opportunityage /*tek_opportunityage*/ - , P1.createdon /*createdon*/ - , P1.createdbyname /*createdbyname*/ - , P1.tek_piplinelastupdatedon /*tek_piplinelastupdatedon*/ - , P1.tek_laststatusdate /*tek_laststatusdate*/ - , P1.tek_channelidname /*tek_channelidname*/ - , P1.tek_tektronixapname /*tek_tektronixapname*/ - , P1.tek_purchasemethodname /*tek_purchasemethodname*/ - , P1.campaignidname /*campaignidname*/ - , P1.tek_webvisitormedium /*tek_webvisitormedium*/ - , P1.tek_webvisitorsource /*tek_webvisitorsource*/ - , P1.tek_customerapplication /*tek_customerapplication*/ - , P1.tek_vertical_segmentname /*tek_vertical_segmentname*/ - , P1.tek_competitivestatusname /*tek_competitivestatusname*/ - , P1.tek_importantopportunityname /*tek_importantopportunityname*/ - , P1.tek_applicationidname /*tek_applicationidname*/ - , P1.tek_industryidname /*tek_industryidname*/ - , P1.estimatedclosedate /*estimatedclosedate*/ - , P1.tek_taglist /*tek_taglist*/ - , P1.discountamount /*discountamount*/ - , P1.tek_terr_areaidname /*tek_terr_areaidname*/ - , P1.tek_terr_branchidname /*tek_terr_branchidname*/ - , P1.tek_extension /*tek_extension*/ - , P1.tek_companynamelegal /*tek_companynamelegal*/ - , P1.accountnumber /*accountnumber*/ - , P1.tek_marketing_program_type_idname /*tek_marketing_program_type_idname*/ - , P1.tek_leadnumber /*tek_leadnumber*/ - , P1.tek_contactnumber /*tek_contactnumber*/ - , P1.parentaccountidname /*parentaccountidname*/ + P1.tek_opportunity_id /*泰克机会编号*/ + , P1.uint_price /*单价*/ + , P1.discount_percent /*折扣率*/ + , P1.discount_amount_base /*基础折扣金额*/ + , P1.base_amount /*基础金额*/ + , P1.total_amount /*总金额*/ + , P1.sales_funnel_stage /*销售漏斗层级*/ + , P1.sales_funnel_stage_id /*销售漏斗层级编号*/ + , P1.status /*状况*/ + , P1.state /*状态*/ + , P1.region /*区域*/ + , P1.opportunity_name /*机会名称*/ + , P1.acount_manager /*账号经理*/ + , P1.territory_id /*领域编号*/ + , P1.forecast_opp_ind /*预期机会标志*/ + , P1.risk_ind /*风险标志*/ + , P1.opportunity_age /*机会年份*/ + , P1.create_time /*创建时间*/ + , P1.create_person /*创建人*/ + , P1.pipline_last_update /*pipline最后更新时间*/ + , P1.status_last_update /*状况最后更新时间*/ + , P1.channel_id /*渠道编号*/ + , P1.tektronix_apname /*tek_tektronixapname*/ + , P1.purchase_method /*采购方式*/ + , P1.campaign_name /*活动名称*/ + , P1.web_medium /*网络媒介*/ + , P1.web_source /*网络来源*/ + , P1.customer_app /*客户应用*/ + , P1.vertical_segment /*垂直领域*/ + , P1.competitive_status /*竞争状态*/ + , P1.important_opportunity_ind /*重要机会标志*/ + , P1.application_name /*应用名称*/ + , P1.opp_industry /*行业(opp)*/ + , P1.estimated_close_time /*预期关闭时间*/ + , P1.tag_list /*标签列表*/ + , P1.discount_amount /*折扣金额*/ + , P1.area_id /*地区编号*/ + , P1.branch_id /*分支编号*/ + , P1.extension_id /*扩展编号*/ + , P1.legal_company_name /*法定公司名称*/ + , P1.account_number /*账号编号*/ + , P1.marketing_program_type /*市场项目类型*/ + , P1.lead_number /*线索编号*/ + , P1.crm_contact_number /*联系人编号*/ + , P1.parent_account_name /*父账号名称*/ , P1.Scd_Start_Dt /*开始时间*/ , P1.Scd_End_Dt /*结束时间*/ , P1.Etl_Batch_No /*作业批次号*/ @@ -429,165 +429,165 @@ SELECT , P1.Etl_Tx_Dt /*作业运行时间*/ , P1.Src_Sysname /*来源系统*/ , P1.Src_Table /*来源表*/ - , P1.parentcontactidname /*parentcontactidname*/ - , P1.tek_productidname /*tek_productidname*/ - , P1.tek_productfamilyidname /*tek_productfamilyidname*/ - , P1.transactioncurrencyidname /*transactioncurrencyidname*/ + , P1.parent_contact_name /*父联系人名称*/ + , P1.product_name /*产品名称*/ + , P1.product_class /*产品类别*/ + , P1.currency_name /*交易币种*/ FROM t01_crm_opportunity_agi_CUR_I P1 LEFT JOIN t01_crm_opportunity_agi_CUR P2 - ON P1.tek_opportunitynumber = P2.tek_opportunitynumber + ON P1.tek_opportunity_id = P2.tek_opportunity_id AND P1.Scd_Start_Dt = P2.Scd_Start_Dt - AND P1.name = P2.name - AND P1.tek_tektronixapname = P2.tek_tektronixapname - AND P1.estimatedclosedate = P2.estimatedclosedate - AND P1.parentaccountidname = P2.parentaccountidname - AND P1.parentcontactidname = P2.parentcontactidname - AND P1.tek_productidname = P2.tek_productidname - AND P1.tek_productfamilyidname = P2.tek_productfamilyidname - AND P1.transactioncurrencyidname = P2.transactioncurrencyidname - AND P1.tek_unitpricetotal_base = P2.tek_unitpricetotal_base - AND P1.tek_totaldiscountpercent = P2.tek_totaldiscountpercent - AND P1.totaldiscountamount_base = P2.totaldiscountamount_base - AND P1.estimatedvalue_base = P2.estimatedvalue_base - AND P1.totalamount = P2.totalamount - AND P1.tek_salesfunnelstagename = P2.tek_salesfunnelstagename - AND P1.tek_funnelstagenumber = P2.tek_funnelstagenumber - AND P1.statuscodename = P2.statuscodename - AND P1.statecodename = P2.statecodename - AND P1.tek_regionidname = P2.tek_regionidname - AND P1.tek_accountmanageridname = P2.tek_accountmanageridname - AND P1.tek_oppterritoryidname = P2.tek_oppterritoryidname - AND P1.tek_opp_includeinforecastname = P2.tek_opp_includeinforecastname - AND P1.tek_isriskname = P2.tek_isriskname - AND P1.tek_opportunityage = P2.tek_opportunityage - AND P1.createdon = P2.createdon - AND P1.createdbyname = P2.createdbyname - AND P1.tek_piplinelastupdatedon = P2.tek_piplinelastupdatedon - AND P1.tek_laststatusdate = P2.tek_laststatusdate - AND P1.tek_channelidname = P2.tek_channelidname - AND P1.tek_purchasemethodname = P2.tek_purchasemethodname - AND P1.campaignidname = P2.campaignidname - AND P1.tek_webvisitormedium = P2.tek_webvisitormedium - AND P1.tek_webvisitorsource = P2.tek_webvisitorsource - AND P1.tek_customerapplication = P2.tek_customerapplication - AND P1.tek_vertical_segmentname = P2.tek_vertical_segmentname - AND P1.tek_competitivestatusname = P2.tek_competitivestatusname - AND P1.tek_importantopportunityname = P2.tek_importantopportunityname - AND P1.tek_applicationidname = P2.tek_applicationidname - AND P1.tek_industryidname = P2.tek_industryidname - AND P1.tek_taglist = P2.tek_taglist - AND P1.discountamount = P2.discountamount - AND P1.tek_terr_areaidname = P2.tek_terr_areaidname - AND P1.tek_terr_branchidname = P2.tek_terr_branchidname - AND P1.tek_extension = P2.tek_extension - AND P1.tek_companynamelegal = P2.tek_companynamelegal - AND P1.accountnumber = P2.accountnumber - AND P1.tek_marketing_program_type_idname = P2.tek_marketing_program_type_idname - AND P1.tek_leadnumber = P2.tek_leadnumber - AND P1.tek_contactnumber = P2.tek_contactnumber + AND P1.opportunity_name = P2.opportunity_name + AND P1.tektronix_apname = P2.tektronix_apname + AND P1.estimated_close_time = P2.estimated_close_time + AND P1.parent_account_name = P2.parent_account_name + AND P1.parent_contact_name = P2.parent_contact_name + AND P1.product_name = P2.product_name + AND P1.product_class = P2.product_class + AND P1.currency_name = P2.currency_name + AND P1.uint_price = P2.uint_price + AND P1.discount_percent = P2.discount_percent + AND P1.discount_amount_base = P2.discount_amount_base + AND P1.base_amount = P2.base_amount + AND P1.total_amount = P2.total_amount + AND P1.sales_funnel_stage = P2.sales_funnel_stage + AND P1.sales_funnel_stage_id = P2.sales_funnel_stage_id + AND P1.status = P2.status + AND P1.state = P2.state + AND P1.region = P2.region + AND P1.acount_manager = P2.acount_manager + AND P1.territory_id = P2.territory_id + AND P1.forecast_opp_ind = P2.forecast_opp_ind + AND P1.risk_ind = P2.risk_ind + AND P1.opportunity_age = P2.opportunity_age + AND P1.create_time = P2.create_time + AND P1.create_person = P2.create_person + AND P1.pipline_last_update = P2.pipline_last_update + AND P1.status_last_update = P2.status_last_update + AND P1.channel_id = P2.channel_id + AND P1.purchase_method = P2.purchase_method + AND P1.campaign_name = P2.campaign_name + AND P1.web_medium = P2.web_medium + AND P1.web_source = P2.web_source + AND P1.customer_app = P2.customer_app + AND P1.vertical_segment = P2.vertical_segment + AND P1.competitive_status = P2.competitive_status + AND P1.important_opportunity_ind = P2.important_opportunity_ind + AND P1.application_name = P2.application_name + AND P1.opp_industry = P2.opp_industry + AND P1.tag_list = P2.tag_list + AND P1.discount_amount = P2.discount_amount + AND P1.area_id = P2.area_id + AND P1.branch_id = P2.branch_id + AND P1.extension_id = P2.extension_id + AND P1.legal_company_name = P2.legal_company_name + AND P1.account_number = P2.account_number + AND P1.marketing_program_type = P2.marketing_program_type + AND P1.lead_number = P2.lead_number + AND P1.crm_contact_number = P2.crm_contact_number AND P2.ETL_Job =:ETLJOB WHERE - P2.tek_opportunitynumber IS NULL + P2.tek_opportunity_id IS NULL AND P2.Scd_Start_Dt IS NULL - AND P2.name IS NULL - AND P2.tek_tektronixapname IS NULL - AND P2.estimatedclosedate IS NULL - AND P2.parentaccountidname IS NULL - AND P2.parentcontactidname IS NULL - AND P2.tek_productidname IS NULL - AND P2.tek_productfamilyidname IS NULL - AND P2.transactioncurrencyidname IS NULL - AND P2.tek_unitpricetotal_base IS NULL - AND P2.tek_totaldiscountpercent IS NULL - AND P2.totaldiscountamount_base IS NULL - AND P2.estimatedvalue_base IS NULL - AND P2.totalamount IS NULL - AND P2.tek_salesfunnelstagename IS NULL - AND P2.tek_funnelstagenumber IS NULL - AND P2.statuscodename IS NULL - AND P2.statecodename IS NULL - AND P2.tek_regionidname IS NULL - AND P2.tek_accountmanageridname IS NULL - AND P2.tek_oppterritoryidname IS NULL - AND P2.tek_opp_includeinforecastname IS NULL - AND P2.tek_isriskname IS NULL - AND P2.tek_opportunityage IS NULL - AND P2.createdon IS NULL - AND P2.createdbyname IS NULL - AND P2.tek_piplinelastupdatedon IS NULL - AND P2.tek_laststatusdate IS NULL - AND P2.tek_channelidname IS NULL - AND P2.tek_purchasemethodname IS NULL - AND P2.campaignidname IS NULL - AND P2.tek_webvisitormedium IS NULL - AND P2.tek_webvisitorsource IS NULL - AND P2.tek_customerapplication IS NULL - AND P2.tek_vertical_segmentname IS NULL - AND P2.tek_competitivestatusname IS NULL - AND P2.tek_importantopportunityname IS NULL - AND P2.tek_applicationidname IS NULL - AND P2.tek_industryidname IS NULL - AND P2.tek_taglist IS NULL - AND P2.discountamount IS NULL - AND P2.tek_terr_areaidname IS NULL - AND P2.tek_terr_branchidname IS NULL - AND P2.tek_extension IS NULL - AND P2.tek_companynamelegal IS NULL - AND P2.accountnumber IS NULL - AND P2.tek_marketing_program_type_idname IS NULL - AND P2.tek_leadnumber IS NULL - AND P2.tek_contactnumber IS NULL + AND P2.opportunity_name IS NULL + AND P2.tektronix_apname IS NULL + AND P2.estimated_close_time IS NULL + AND P2.parent_account_name IS NULL + AND P2.parent_contact_name IS NULL + AND P2.product_name IS NULL + AND P2.product_class IS NULL + AND P2.currency_name IS NULL + AND P2.uint_price IS NULL + AND P2.discount_percent IS NULL + AND P2.discount_amount_base IS NULL + AND P2.base_amount IS NULL + AND P2.total_amount IS NULL + AND P2.sales_funnel_stage IS NULL + AND P2.sales_funnel_stage_id IS NULL + AND P2.status IS NULL + AND P2.state IS NULL + AND P2.region IS NULL + AND P2.acount_manager IS NULL + AND P2.territory_id IS NULL + AND P2.forecast_opp_ind IS NULL + AND P2.risk_ind IS NULL + AND P2.opportunity_age IS NULL + AND P2.create_time IS NULL + AND P2.create_person IS NULL + AND P2.pipline_last_update IS NULL + AND P2.status_last_update IS NULL + AND P2.channel_id IS NULL + AND P2.purchase_method IS NULL + AND P2.campaign_name IS NULL + AND P2.web_medium IS NULL + AND P2.web_source IS NULL + AND P2.customer_app IS NULL + AND P2.vertical_segment IS NULL + AND P2.competitive_status IS NULL + AND P2.important_opportunity_ind IS NULL + AND P2.application_name IS NULL + AND P2.opp_industry IS NULL + AND P2.tag_list IS NULL + AND P2.discount_amount IS NULL + AND P2.area_id IS NULL + AND P2.branch_id IS NULL + AND P2.extension_id IS NULL + AND P2.legal_company_name IS NULL + AND P2.account_number IS NULL + AND P2.marketing_program_type IS NULL + AND P2.lead_number IS NULL + AND P2.crm_contact_number IS NULL ; INSERT INTO t01_crm_opportunity_agi_CUR_D ( - tek_opportunitynumber /*tek_opportunitynumber*/ - , tek_unitpricetotal_base /*tek_unitpricetotal_base*/ - , tek_totaldiscountpercent /*tek_totaldiscountpercent*/ - , totaldiscountamount_base /*totaldiscountamount_base*/ - , estimatedvalue_base /*estimatedvalue_base*/ - , totalamount /*totalamount*/ - , tek_salesfunnelstagename /*tek_salesfunnelstagename*/ - , tek_funnelstagenumber /*tek_funnelstagenumber*/ - , statuscodename /*statuscodename*/ - , statecodename /*statecodename*/ - , tek_regionidname /*tek_regionidname*/ - , name /*name*/ - , tek_accountmanageridname /*tek_accountmanageridname*/ - , tek_oppterritoryidname /*tek_oppterritoryidname*/ - , tek_opp_includeinforecastname /*tek_opp_includeinforecastname*/ - , tek_isriskname /*tek_isriskname*/ - , tek_opportunityage /*tek_opportunityage*/ - , createdon /*createdon*/ - , createdbyname /*createdbyname*/ - , tek_piplinelastupdatedon /*tek_piplinelastupdatedon*/ - , tek_laststatusdate /*tek_laststatusdate*/ - , tek_channelidname /*tek_channelidname*/ - , tek_tektronixapname /*tek_tektronixapname*/ - , tek_purchasemethodname /*tek_purchasemethodname*/ - , campaignidname /*campaignidname*/ - , tek_webvisitormedium /*tek_webvisitormedium*/ - , tek_webvisitorsource /*tek_webvisitorsource*/ - , tek_customerapplication /*tek_customerapplication*/ - , tek_vertical_segmentname /*tek_vertical_segmentname*/ - , tek_competitivestatusname /*tek_competitivestatusname*/ - , tek_importantopportunityname /*tek_importantopportunityname*/ - , tek_applicationidname /*tek_applicationidname*/ - , tek_industryidname /*tek_industryidname*/ - , estimatedclosedate /*estimatedclosedate*/ - , tek_taglist /*tek_taglist*/ - , discountamount /*discountamount*/ - , tek_terr_areaidname /*tek_terr_areaidname*/ - , tek_terr_branchidname /*tek_terr_branchidname*/ - , tek_extension /*tek_extension*/ - , tek_companynamelegal /*tek_companynamelegal*/ - , accountnumber /*accountnumber*/ - , tek_marketing_program_type_idname /*tek_marketing_program_type_idname*/ - , tek_leadnumber /*tek_leadnumber*/ - , tek_contactnumber /*tek_contactnumber*/ - , parentaccountidname /*parentaccountidname*/ + tek_opportunity_id /*泰克机会编号*/ + , uint_price /*单价*/ + , discount_percent /*折扣率*/ + , discount_amount_base /*基础折扣金额*/ + , base_amount /*基础金额*/ + , total_amount /*总金额*/ + , sales_funnel_stage /*销售漏斗层级*/ + , sales_funnel_stage_id /*销售漏斗层级编号*/ + , status /*状况*/ + , state /*状态*/ + , region /*区域*/ + , opportunity_name /*机会名称*/ + , acount_manager /*账号经理*/ + , territory_id /*领域编号*/ + , forecast_opp_ind /*预期机会标志*/ + , risk_ind /*风险标志*/ + , opportunity_age /*机会年份*/ + , create_time /*创建时间*/ + , create_person /*创建人*/ + , pipline_last_update /*pipline最后更新时间*/ + , status_last_update /*状况最后更新时间*/ + , channel_id /*渠道编号*/ + , tektronix_apname /*tek_tektronixapname*/ + , purchase_method /*采购方式*/ + , campaign_name /*活动名称*/ + , web_medium /*网络媒介*/ + , web_source /*网络来源*/ + , customer_app /*客户应用*/ + , vertical_segment /*垂直领域*/ + , competitive_status /*竞争状态*/ + , important_opportunity_ind /*重要机会标志*/ + , application_name /*应用名称*/ + , opp_industry /*行业(opp)*/ + , estimated_close_time /*预期关闭时间*/ + , tag_list /*标签列表*/ + , discount_amount /*折扣金额*/ + , area_id /*地区编号*/ + , branch_id /*分支编号*/ + , extension_id /*扩展编号*/ + , legal_company_name /*法定公司名称*/ + , account_number /*账号编号*/ + , marketing_program_type /*市场项目类型*/ + , lead_number /*线索编号*/ + , crm_contact_number /*联系人编号*/ + , parent_account_name /*父账号名称*/ , Scd_Start_Dt /*开始时间*/ , Scd_End_Dt /*结束时间*/ , Etl_Batch_No /*作业批次号*/ @@ -597,57 +597,57 @@ INSERT INTO t01_crm_opportunity_agi_CUR_D ( , Etl_Tx_Dt /*作业运行时间*/ , Src_Sysname /*来源系统*/ , Src_Table /*来源表*/ - , parentcontactidname /*parentcontactidname*/ - , tek_productidname /*tek_productidname*/ - , tek_productfamilyidname /*tek_productfamilyidname*/ - , transactioncurrencyidname /*transactioncurrencyidname*/ + , parent_contact_name /*父联系人名称*/ + , product_name /*产品名称*/ + , product_class /*产品类别*/ + , currency_name /*交易币种*/ ) SELECT - P1.tek_opportunitynumber /*tek_opportunitynumber*/ - , P1.tek_unitpricetotal_base /*tek_unitpricetotal_base*/ - , P1.tek_totaldiscountpercent /*tek_totaldiscountpercent*/ - , P1.totaldiscountamount_base /*totaldiscountamount_base*/ - , P1.estimatedvalue_base /*estimatedvalue_base*/ - , P1.totalamount /*totalamount*/ - , P1.tek_salesfunnelstagename /*tek_salesfunnelstagename*/ - , P1.tek_funnelstagenumber /*tek_funnelstagenumber*/ - , P1.statuscodename /*statuscodename*/ - , P1.statecodename /*statecodename*/ - , P1.tek_regionidname /*tek_regionidname*/ - , P1.name /*name*/ - , P1.tek_accountmanageridname /*tek_accountmanageridname*/ - , P1.tek_oppterritoryidname /*tek_oppterritoryidname*/ - , P1.tek_opp_includeinforecastname /*tek_opp_includeinforecastname*/ - , P1.tek_isriskname /*tek_isriskname*/ - , P1.tek_opportunityage /*tek_opportunityage*/ - , P1.createdon /*createdon*/ - , P1.createdbyname /*createdbyname*/ - , P1.tek_piplinelastupdatedon /*tek_piplinelastupdatedon*/ - , P1.tek_laststatusdate /*tek_laststatusdate*/ - , P1.tek_channelidname /*tek_channelidname*/ - , P1.tek_tektronixapname /*tek_tektronixapname*/ - , P1.tek_purchasemethodname /*tek_purchasemethodname*/ - , P1.campaignidname /*campaignidname*/ - , P1.tek_webvisitormedium /*tek_webvisitormedium*/ - , P1.tek_webvisitorsource /*tek_webvisitorsource*/ - , P1.tek_customerapplication /*tek_customerapplication*/ - , P1.tek_vertical_segmentname /*tek_vertical_segmentname*/ - , P1.tek_competitivestatusname /*tek_competitivestatusname*/ - , P1.tek_importantopportunityname /*tek_importantopportunityname*/ - , P1.tek_applicationidname /*tek_applicationidname*/ - , P1.tek_industryidname /*tek_industryidname*/ - , P1.estimatedclosedate /*estimatedclosedate*/ - , P1.tek_taglist /*tek_taglist*/ - , P1.discountamount /*discountamount*/ - , P1.tek_terr_areaidname /*tek_terr_areaidname*/ - , P1.tek_terr_branchidname /*tek_terr_branchidname*/ - , P1.tek_extension /*tek_extension*/ - , P1.tek_companynamelegal /*tek_companynamelegal*/ - , P1.accountnumber /*accountnumber*/ - , P1.tek_marketing_program_type_idname /*tek_marketing_program_type_idname*/ - , P1.tek_leadnumber /*tek_leadnumber*/ - , P1.tek_contactnumber /*tek_contactnumber*/ - , P1.parentaccountidname /*parentaccountidname*/ + P1.tek_opportunity_id /*泰克机会编号*/ + , P1.uint_price /*单价*/ + , P1.discount_percent /*折扣率*/ + , P1.discount_amount_base /*基础折扣金额*/ + , P1.base_amount /*基础金额*/ + , P1.total_amount /*总金额*/ + , P1.sales_funnel_stage /*销售漏斗层级*/ + , P1.sales_funnel_stage_id /*销售漏斗层级编号*/ + , P1.status /*状况*/ + , P1.state /*状态*/ + , P1.region /*区域*/ + , P1.opportunity_name /*机会名称*/ + , P1.acount_manager /*账号经理*/ + , P1.territory_id /*领域编号*/ + , P1.forecast_opp_ind /*预期机会标志*/ + , P1.risk_ind /*风险标志*/ + , P1.opportunity_age /*机会年份*/ + , P1.create_time /*创建时间*/ + , P1.create_person /*创建人*/ + , P1.pipline_last_update /*pipline最后更新时间*/ + , P1.status_last_update /*状况最后更新时间*/ + , P1.channel_id /*渠道编号*/ + , P1.tektronix_apname /*tek_tektronixapname*/ + , P1.purchase_method /*采购方式*/ + , P1.campaign_name /*活动名称*/ + , P1.web_medium /*网络媒介*/ + , P1.web_source /*网络来源*/ + , P1.customer_app /*客户应用*/ + , P1.vertical_segment /*垂直领域*/ + , P1.competitive_status /*竞争状态*/ + , P1.important_opportunity_ind /*重要机会标志*/ + , P1.application_name /*应用名称*/ + , P1.opp_industry /*行业(opp)*/ + , P1.estimated_close_time /*预期关闭时间*/ + , P1.tag_list /*标签列表*/ + , P1.discount_amount /*折扣金额*/ + , P1.area_id /*地区编号*/ + , P1.branch_id /*分支编号*/ + , P1.extension_id /*扩展编号*/ + , P1.legal_company_name /*法定公司名称*/ + , P1.account_number /*账号编号*/ + , P1.marketing_program_type /*市场项目类型*/ + , P1.lead_number /*线索编号*/ + , P1.crm_contact_number /*联系人编号*/ + , P1.parent_account_name /*父账号名称*/ , P1.Scd_Start_Dt /*开始时间*/ , P1.Scd_End_Dt /*结束时间*/ , P1.Etl_Batch_No /*作业批次号*/ @@ -657,16 +657,16 @@ SELECT , P1.Etl_Tx_Dt /*作业运行时间*/ , P1.Src_Sysname /*来源系统*/ , P1.Src_Table /*来源表*/ - , P1.parentcontactidname /*parentcontactidname*/ - , P1.tek_productidname /*tek_productidname*/ - , P1.tek_productfamilyidname /*tek_productfamilyidname*/ - , P1.transactioncurrencyidname /*transactioncurrencyidname*/ + , P1.parent_contact_name /*父联系人名称*/ + , P1.product_name /*产品名称*/ + , P1.product_class /*产品类别*/ + , P1.currency_name /*交易币种*/ FROM t01_crm_opportunity_agi_CUR_I P1 LEFT JOIN t01_crm_opportunity_agi_CUR P2 -ON P1.tek_opportunitynumber = P2.tek_opportunitynumber +ON P1.tek_opportunity_id = P2.tek_opportunity_id AND P1.Scd_Start_Dt = P2.Scd_Start_Dt -WHERE P2.tek_opportunitynumber IS NULL +WHERE P2.tek_opportunity_id IS NULL AND P2.Scd_Start_Dt IS NULL AND P2.Scd_End_Dt = TO_DATE(:MAXDATE,'YYYYMMDD') AND P2.ETL_Job = :ETLJOB @@ -680,8 +680,8 @@ UPDATE :PDMDB.t01_crm_opportunity ,Etl_Proc_Dt=CURRENT_TIMESTAMP(0) WHERE Scd_End_Dt = TO_DATE(:MAXDATE, 'YYYYMMDD') AND (:PDMDB.t01_crm_opportunity.ETL_Job = :ETLJOB) - AND ( tek_opportunitynumber , Scd_Start_Dt) -IN (SELECT tek_opportunitynumber , Scd_Start_Dt + AND ( tek_opportunity_id , Scd_Start_Dt) +IN (SELECT tek_opportunity_id , Scd_Start_Dt FROM t01_crm_opportunity_agi_INS) /*根据比对条件将目标表中删除数据进行相应的处理 */ @@ -691,57 +691,57 @@ IN (SELECT tek_opportunitynumber , Scd_Start_Dt ,ETL_Proc_Dt=CURRENT_TIMESTAMP(0) WHERE Scd_End_Dt=TO_DATE(:MAXDATE,'YYYYMMDD') AND (:PDMDB.t01_crm_opportunity.ETL_Job = :ETLJOB) - AND ( tek_opportunitynumber , Scd_Start_Dt) + AND ( tek_opportunity_id , Scd_Start_Dt) IN (SELECT - tek_opportunitynumber , Scd_Start_Dt + tek_opportunity_id , Scd_Start_Dt FROM t01_crm_opportunity_agi_CUR_D) /*然后将新增的数据插入到目标表中,置开始日期为TX_DATE,结束日期置为MAXDATE */ ;INSERT INTO :PDMDB.t01_crm_opportunity ( - tek_opportunitynumber /*tek_opportunitynumber*/ - ,tek_unitpricetotal_base /*tek_unitpricetotal_base*/ - ,tek_totaldiscountpercent /*tek_totaldiscountpercent*/ - ,totaldiscountamount_base /*totaldiscountamount_base*/ - ,estimatedvalue_base /*estimatedvalue_base*/ - ,totalamount /*totalamount*/ - ,tek_salesfunnelstagename /*tek_salesfunnelstagename*/ - ,tek_funnelstagenumber /*tek_funnelstagenumber*/ - ,statuscodename /*statuscodename*/ - ,statecodename /*statecodename*/ - ,tek_regionidname /*tek_regionidname*/ - ,name /*name*/ - ,tek_accountmanageridname /*tek_accountmanageridname*/ - ,tek_oppterritoryidname /*tek_oppterritoryidname*/ - ,tek_opp_includeinforecastname /*tek_opp_includeinforecastname*/ - ,tek_isriskname /*tek_isriskname*/ - ,tek_opportunityage /*tek_opportunityage*/ - ,createdon /*createdon*/ - ,createdbyname /*createdbyname*/ - ,tek_piplinelastupdatedon /*tek_piplinelastupdatedon*/ - ,tek_laststatusdate /*tek_laststatusdate*/ - ,tek_channelidname /*tek_channelidname*/ - ,tek_tektronixapname /*tek_tektronixapname*/ - ,tek_purchasemethodname /*tek_purchasemethodname*/ - ,campaignidname /*campaignidname*/ - ,tek_webvisitormedium /*tek_webvisitormedium*/ - ,tek_webvisitorsource /*tek_webvisitorsource*/ - ,tek_customerapplication /*tek_customerapplication*/ - ,tek_vertical_segmentname /*tek_vertical_segmentname*/ - ,tek_competitivestatusname /*tek_competitivestatusname*/ - ,tek_importantopportunityname /*tek_importantopportunityname*/ - ,tek_applicationidname /*tek_applicationidname*/ - ,tek_industryidname /*tek_industryidname*/ - ,estimatedclosedate /*estimatedclosedate*/ - ,tek_taglist /*tek_taglist*/ - ,discountamount /*discountamount*/ - ,tek_terr_areaidname /*tek_terr_areaidname*/ - ,tek_terr_branchidname /*tek_terr_branchidname*/ - ,tek_extension /*tek_extension*/ - ,tek_companynamelegal /*tek_companynamelegal*/ - ,accountnumber /*accountnumber*/ - ,tek_marketing_program_type_idname /*tek_marketing_program_type_idname*/ - ,tek_leadnumber /*tek_leadnumber*/ - ,tek_contactnumber /*tek_contactnumber*/ - ,parentaccountidname /*parentaccountidname*/ + tek_opportunity_id /*泰克机会编号*/ + ,uint_price /*单价*/ + ,discount_percent /*折扣率*/ + ,discount_amount_base /*基础折扣金额*/ + ,base_amount /*基础金额*/ + ,total_amount /*总金额*/ + ,sales_funnel_stage /*销售漏斗层级*/ + ,sales_funnel_stage_id /*销售漏斗层级编号*/ + ,status /*状况*/ + ,state /*状态*/ + ,region /*区域*/ + ,opportunity_name /*机会名称*/ + ,acount_manager /*账号经理*/ + ,territory_id /*领域编号*/ + ,forecast_opp_ind /*预期机会标志*/ + ,risk_ind /*风险标志*/ + ,opportunity_age /*机会年份*/ + ,create_time /*创建时间*/ + ,create_person /*创建人*/ + ,pipline_last_update /*pipline最后更新时间*/ + ,status_last_update /*状况最后更新时间*/ + ,channel_id /*渠道编号*/ + ,tektronix_apname /*tek_tektronixapname*/ + ,purchase_method /*采购方式*/ + ,campaign_name /*活动名称*/ + ,web_medium /*网络媒介*/ + ,web_source /*网络来源*/ + ,customer_app /*客户应用*/ + ,vertical_segment /*垂直领域*/ + ,competitive_status /*竞争状态*/ + ,important_opportunity_ind /*重要机会标志*/ + ,application_name /*应用名称*/ + ,opp_industry /*行业(opp)*/ + ,estimated_close_time /*预期关闭时间*/ + ,tag_list /*标签列表*/ + ,discount_amount /*折扣金额*/ + ,area_id /*地区编号*/ + ,branch_id /*分支编号*/ + ,extension_id /*扩展编号*/ + ,legal_company_name /*法定公司名称*/ + ,account_number /*账号编号*/ + ,marketing_program_type /*市场项目类型*/ + ,lead_number /*线索编号*/ + ,crm_contact_number /*联系人编号*/ + ,parent_account_name /*父账号名称*/ ,Scd_Start_Dt /*开始时间*/ ,Scd_End_Dt /*结束时间*/ ,Etl_Batch_No /*作业批次号*/ @@ -751,57 +751,57 @@ FROM t01_crm_opportunity_agi_CUR_D) ,Etl_Tx_Dt /*作业运行时间*/ ,Src_Sysname /*来源系统*/ ,Src_Table /*来源表*/ - ,parentcontactidname /*parentcontactidname*/ - ,tek_productidname /*tek_productidname*/ - ,tek_productfamilyidname /*tek_productfamilyidname*/ - ,transactioncurrencyidname /*transactioncurrencyidname*/ + ,parent_contact_name /*父联系人名称*/ + ,product_name /*产品名称*/ + ,product_class /*产品类别*/ + ,currency_name /*交易币种*/ ) SELECT - P1.tek_opportunitynumber /*tek_opportunitynumber*/ - ,P1.tek_unitpricetotal_base /*tek_unitpricetotal_base*/ - ,P1.tek_totaldiscountpercent /*tek_totaldiscountpercent*/ - ,P1.totaldiscountamount_base /*totaldiscountamount_base*/ - ,P1.estimatedvalue_base /*estimatedvalue_base*/ - ,P1.totalamount /*totalamount*/ - ,P1.tek_salesfunnelstagename /*tek_salesfunnelstagename*/ - ,P1.tek_funnelstagenumber /*tek_funnelstagenumber*/ - ,P1.statuscodename /*statuscodename*/ - ,P1.statecodename /*statecodename*/ - ,P1.tek_regionidname /*tek_regionidname*/ - ,P1.name /*name*/ - ,P1.tek_accountmanageridname /*tek_accountmanageridname*/ - ,P1.tek_oppterritoryidname /*tek_oppterritoryidname*/ - ,P1.tek_opp_includeinforecastname /*tek_opp_includeinforecastname*/ - ,P1.tek_isriskname /*tek_isriskname*/ - ,P1.tek_opportunityage /*tek_opportunityage*/ - ,P1.createdon /*createdon*/ - ,P1.createdbyname /*createdbyname*/ - ,P1.tek_piplinelastupdatedon /*tek_piplinelastupdatedon*/ - ,P1.tek_laststatusdate /*tek_laststatusdate*/ - ,P1.tek_channelidname /*tek_channelidname*/ - ,P1.tek_tektronixapname /*tek_tektronixapname*/ - ,P1.tek_purchasemethodname /*tek_purchasemethodname*/ - ,P1.campaignidname /*campaignidname*/ - ,P1.tek_webvisitormedium /*tek_webvisitormedium*/ - ,P1.tek_webvisitorsource /*tek_webvisitorsource*/ - ,P1.tek_customerapplication /*tek_customerapplication*/ - ,P1.tek_vertical_segmentname /*tek_vertical_segmentname*/ - ,P1.tek_competitivestatusname /*tek_competitivestatusname*/ - ,P1.tek_importantopportunityname /*tek_importantopportunityname*/ - ,P1.tek_applicationidname /*tek_applicationidname*/ - ,P1.tek_industryidname /*tek_industryidname*/ - ,P1.estimatedclosedate /*estimatedclosedate*/ - ,P1.tek_taglist /*tek_taglist*/ - ,P1.discountamount /*discountamount*/ - ,P1.tek_terr_areaidname /*tek_terr_areaidname*/ - ,P1.tek_terr_branchidname /*tek_terr_branchidname*/ - ,P1.tek_extension /*tek_extension*/ - ,P1.tek_companynamelegal /*tek_companynamelegal*/ - ,P1.accountnumber /*accountnumber*/ - ,P1.tek_marketing_program_type_idname /*tek_marketing_program_type_idname*/ - ,P1.tek_leadnumber /*tek_leadnumber*/ - ,P1.tek_contactnumber /*tek_contactnumber*/ - ,P1.parentaccountidname /*parentaccountidname*/ + P1.tek_opportunity_id /*泰克机会编号*/ + ,P1.uint_price /*单价*/ + ,P1.discount_percent /*折扣率*/ + ,P1.discount_amount_base /*基础折扣金额*/ + ,P1.base_amount /*基础金额*/ + ,P1.total_amount /*总金额*/ + ,P1.sales_funnel_stage /*销售漏斗层级*/ + ,P1.sales_funnel_stage_id /*销售漏斗层级编号*/ + ,P1.status /*状况*/ + ,P1.state /*状态*/ + ,P1.region /*区域*/ + ,P1.opportunity_name /*机会名称*/ + ,P1.acount_manager /*账号经理*/ + ,P1.territory_id /*领域编号*/ + ,P1.forecast_opp_ind /*预期机会标志*/ + ,P1.risk_ind /*风险标志*/ + ,P1.opportunity_age /*机会年份*/ + ,P1.create_time /*创建时间*/ + ,P1.create_person /*创建人*/ + ,P1.pipline_last_update /*pipline最后更新时间*/ + ,P1.status_last_update /*状况最后更新时间*/ + ,P1.channel_id /*渠道编号*/ + ,P1.tektronix_apname /*tek_tektronixapname*/ + ,P1.purchase_method /*采购方式*/ + ,P1.campaign_name /*活动名称*/ + ,P1.web_medium /*网络媒介*/ + ,P1.web_source /*网络来源*/ + ,P1.customer_app /*客户应用*/ + ,P1.vertical_segment /*垂直领域*/ + ,P1.competitive_status /*竞争状态*/ + ,P1.important_opportunity_ind /*重要机会标志*/ + ,P1.application_name /*应用名称*/ + ,P1.opp_industry /*行业(opp)*/ + ,P1.estimated_close_time /*预期关闭时间*/ + ,P1.tag_list /*标签列表*/ + ,P1.discount_amount /*折扣金额*/ + ,P1.area_id /*地区编号*/ + ,P1.branch_id /*分支编号*/ + ,P1.extension_id /*扩展编号*/ + ,P1.legal_company_name /*法定公司名称*/ + ,P1.account_number /*账号编号*/ + ,P1.marketing_program_type /*市场项目类型*/ + ,P1.lead_number /*线索编号*/ + ,P1.crm_contact_number /*联系人编号*/ + ,P1.parent_account_name /*父账号名称*/ ,P1.Scd_Start_Dt /*开始时间*/ ,P1.Scd_End_Dt /*结束时间*/ ,P1.Etl_Batch_No /*作业批次号*/ @@ -811,10 +811,10 @@ SELECT ,P1.Etl_Tx_Dt /*作业运行时间*/ ,P1.Src_Sysname /*来源系统*/ ,P1.Src_Table /*来源表*/ - ,P1.parentcontactidname /*parentcontactidname*/ - ,P1.tek_productidname /*tek_productidname*/ - ,P1.tek_productfamilyidname /*tek_productfamilyidname*/ - ,P1.transactioncurrencyidname /*transactioncurrencyidname*/ + ,P1.parent_contact_name /*父联系人名称*/ + ,P1.product_name /*产品名称*/ + ,P1.product_class /*产品类别*/ + ,P1.currency_name /*交易币种*/ FROM t01_crm_opportunity_agi_INS P1 ;