ECC Service Contracts, Service Contract Customer Details, SQL1

Description
Columns: Ecc Spec Id, Contract Id, Contract Number, Contract Modifier, Contract Status Group, Contract End Date, Contract Termination Date, Party Name, Party Number, Overdue Inv Amt ...
Imported from ECC
select * from (SELECT        ecc_spec_id,
  language_code,
  contract_id,
  contract_number,
  contract_modifier,
  contract_status_group,
  contract_end_date,
  contract_termination_date,
  party_name,
  party_number,
  overdue_inv_amt,
  overdue_inv_count,
  late_pay_amt,
  tca_sst_org_profile_id,
  tca_sst_party_id,
  tca_sst_location_id,
  tca_sst_primary_name,
  tca_sst_alternate_name,
  tca_sst_enquiry_duns,
  tca_sst_org_last_update_date,
  tca_sst_source_number,
  tca_sst_primary_address,
  tca_sst_city_state,
  tca_sst_city,
  tca_sst_state,
  tca_sst_county,
  tca_sst_postal_code,
  tca_sst_country,
  tca_sst_phone_number,
  tca_det_history_ind,
  tca_fincl_embt_ind,
  tca_criminal_procd_ind,
  tca_claims_ind,
  tca_fincl_lgl_event_ind,
  tca_disaster_ind,
  tca_oprg_spec_event_ind,
  tca_suit_ind,
  tca_judge_ind,
  tca_sst_spcl_event_comment,
  tca_sst_num_spcl_event,
  tca_sst_duns_number_c,
  tca_sst_do_not_confuse_with,
  tca_sst_fax_number,
  tca_sst_ceo_title_name,
  tca_sst_principal_title_name,
  tca_hq_branch_ind,
  tca_legal_status,
  tca_sst_organization_type,
  tca_registration_type,
  tca_oob_ind,
  tca_sst_employees_total,
  tca_include_subsidiary,
  tca_employee_total_est,
  tca_employee_total_min,
  tca_sst_employees_here,
  tca_emp_here_est,
  tca_employee_here_minimum,
  tca_db_db_rating,
  tca_bankruptcy_ind,
  tca_prnt_hq_bkcy_ind,
  tca_db_num_prnt_bkcy_filing,
  tca_db_prnt_bkcy_filg_type,
  tca_db_prnt_bkcy_filg_chapter,
  tca_db_prnt_bkcy_filg_date,
  tca_db_num_prnt_bkcy_convs,
  tca_db_prnt_bkcy_conv_date,
  tca_db_prnt_bkcy_chapter_conv,
  tca_db_paydex_current,
  tca_db_dlqn_score,
  tca_dlqn_score_commentary,
  tca_db_dlqn_score_class,
  tca_db_dlqn_score_natl_per,
  tca_db_failure_score,
  tca_failure_score_commtry,
  tca_db_failure_score_class,
  tca_minority_owned,
  tca_woman_owned,
  tca_disadv_8a,
  tca_finrep_organization_prf_id,
  tca_finrep_current_ratio,
  tca_finrep_income_statement_dt,
  tca_finrep_net_income,
  tca_finrep_net_worth,
  tca_finrep_prev_net_worth,
  tca_finrep_sales,
  tca_finrep_total_liab_equity,
  tca_credit_class,
  tca_credit_hold
 FROM oks_k_cust_ecc_v WHERE (
    (contract_end_date >= NVL(fnd_date.canonical_to_date(fnd_profile.value('OKS_ECC_CONTARCT_FROM_DATE')),sysdate))
and language_code in ('US')))
 pivot
(
max(tca_det_history_ind)	as	tca_det_history_ind,
max(tca_fincl_embt_ind)	as	tca_fincl_embt_ind,
max(tca_criminal_procd_ind)	as	tca_criminal_procd_ind,
max(tca_claims_ind)	as	tca_claims_ind,
max(tca_fincl_lgl_event_ind)	as	tca_fincl_lgl_event_ind,
max(tca_disaster_ind)	as	tca_disaster_ind,
max(tca_oprg_spec_event_ind)	as	tca_oprg_spec_event_ind,
max(tca_suit_ind)	as	tca_suit_ind,
max(tca_judge_ind)	as	tca_judge_ind,
max(tca_hq_branch_ind)	as	tca_hq_branch_ind,
max(tca_legal_status)	as	tca_legal_status,
max(tca_registration_type)	as	tca_registration_type,
max(tca_oob_ind)	as	tca_oob_ind,
max(tca_include_subsidiary)	as	tca_include_subsidiary,
max(tca_employee_total_est)	as	tca_employee_total_est,
max(tca_employee_total_min)	as	tca_employee_total_min,
max(tca_emp_here_est)	as	tca_emp_here_est,
max(tca_employee_here_minimum)	as	tca_employee_here_minimum,
max(tca_bankruptcy_ind)	as	tca_bankruptcy_ind,
max(tca_prnt_hq_bkcy_ind)	as	tca_prnt_hq_bkcy_ind,
max(tca_dlqn_score_commentary)	as	tca_dlqn_score_commentary,
max(tca_failure_score_commtry)	as	tca_failure_score_commtry,
max(tca_minority_owned)	as	tca_minority_owned,
max(tca_woman_owned)	as	tca_woman_owned,
max(tca_disadv_8a)	as	tca_disadv_8a
         for language_code in ('US' "US"))