/*******Main Section**************************************************************************/
\set ON_ERROR_STOP on
\set AUTOCOMMIT on
\timing on
delete from p10_sa.S98_S_livechat
;
insert into p10_sa.S98_S_livechat
(	 conference_id  
	, chat_creation_date  
	, chat_start_date  
	, chat_start_url  
	, referrer  
	, chat_duration  
	, queue_duration  
	, visitor_livechat_id  
	, visitor_nick  
	, visitor_ip  
	, visitor_email  
	, last_operator_id  
	, group_id  
	, group_name  
	, rate  
	, last_rate_comment  
	, operator_1_nick  
	, operator_2_nick  
	, operator_3_nick  
	, operator_4_nick  
	, operator_5_nick  
	, operator_6_nick  
	, operator_7_nick  
	, operator_8_nick  
	, operator_9_nick  
	, operator_10_nick  
	, operator_11_nick  
	, operator_1_id  
	, operator_2_id  
	, operator_3_id  
	, operator_4_id  
	, operator_5_id  
	, operator_6_id  
	, operator_7_id  
	, operator_8_id  
	, operator_9_id  
	, operator_10_id  
	, operator_11_id  
	, operator_1_time_zone  
	, operator_2_time_zone  
	, operator_3_time_zone  
	, operator_4_time_zone  
	, operator_5_time_zone  
	, operator_6_time_zone  
	, operator_7_time_zone  
	, operator_8_time_zone  
	, operator_9_time_zone  
	, operator_10_time_zone  
	, operator_11_time_zone  
	, pre_chat_service  
	, pre_chat_name  
	, pre_chat_contact  
	, pre_chat_email  
	, pre_chat_company  
	, pre_chat_service_t  
	, pre_chat_email_t  
	, pre_chat_contact_t  
	, pre_chat_company_t  
	, pre_chat_name_j  
	, pre_chat_email_j  
	, pre_chat_private_policy  
	, pre_chat_know_policy  
	, pre_chat_agree_policy  
	, pre_chat_agree_policy_k  
	, pre_chat_agree_for_sale  
	, pre_chat_company_k  
	, pre_chat_name_k  
	, pre_chat_contact_k  
	, pre_chat_email_k  
	, pre_chat_service_k  
	, pre_chat_contact_2  
	, pre_chat_contact_3  
	, post_chat_first  
	, post_chat_where_chat  
	, post_chat_help  
	, post_chat_where_2  
	, post_chat_first_j  
	, post_chat_help_j  
	, post_chat_message_j  
	, auto_invite_url  
	, auto_invite_action  
	, goal_action_name  
	, goal_done_by  
	, goal_done_date  
	, tag_1  
	, tag_2  
	, tag_3  
	, tag_4  
	, tag_5  
	, cust_var_1_name  
	, cust_var_1_value  
	, first_response_time  
	, average_response_time  
	, agents_chatting_duration  
	, visitor_user_agent  
	, group_status_at_start  
	, visitor_country_code  
	, etl_tx_dt   )
  select 
	 conference_id  
	, chat_creation_date  
	, chat_start_date  
	, chat_start_url  
	, referrer  
	, chat_duration  
	, queue_duration  
	, visitor_livechat_id  
	, visitor_nick  
	, visitor_ip  
	, visitor_email  
	, last_operator_id  
	, group_id  
	, group_name  
	, rate  
	, last_rate_comment  
	, operator_1_nick  
	, operator_2_nick  
	, operator_3_nick  
	, operator_4_nick  
	, operator_5_nick  
	, operator_6_nick  
	, operator_7_nick  
	, operator_8_nick  
	, operator_9_nick  
	, operator_10_nick  
	, operator_11_nick  
	, operator_1_id  
	, operator_2_id  
	, operator_3_id  
	, operator_4_id  
	, operator_5_id  
	, operator_6_id  
	, operator_7_id  
	, operator_8_id  
	, operator_9_id  
	, operator_10_id  
	, operator_11_id  
	, operator_1_time_zone  
	, operator_2_time_zone  
	, operator_3_time_zone  
	, operator_4_time_zone  
	, operator_5_time_zone  
	, operator_6_time_zone  
	, operator_7_time_zone  
	, operator_8_time_zone  
	, operator_9_time_zone  
	, operator_10_time_zone  
	, operator_11_time_zone  
	, pre_chat_service  
	, pre_chat_name  
	, pre_chat_contact  
	, pre_chat_email  
	, pre_chat_company  
	, pre_chat_service_t  
	, pre_chat_email_t  
	, pre_chat_contact_t  
	, pre_chat_company_t  
	, pre_chat_name_j  
	, pre_chat_email_j  
	, pre_chat_private_policy  
	, pre_chat_know_policy  
	, pre_chat_agree_policy  
	, pre_chat_agree_policy_k  
	, pre_chat_agree_for_sale  
	, pre_chat_company_k  
	, pre_chat_name_k  
	, pre_chat_contact_k  
	, pre_chat_email_k  
	, pre_chat_service_k  
	, pre_chat_contact_2  
	, pre_chat_contact_3  
	, post_chat_first  
	, post_chat_where_chat  
	, post_chat_help  
	, post_chat_where_2  
	, post_chat_first_j  
	, post_chat_help_j  
	, post_chat_message_j  
	, auto_invite_url  
	, auto_invite_action  
	, goal_action_name  
	, goal_done_by  
	, goal_done_date  
	, tag_1  
	, tag_2  
	, tag_3  
	, tag_4  
	, tag_5  
	, cust_var_1_name  
	, cust_var_1_value  
	, first_response_time  
	, average_response_time  
	, agents_chatting_duration  
	, visitor_user_agent  
	, group_status_at_start  
	, visitor_country_code  
	, etl_tx_dt  
  from p00_tal.S98_S_livechat
  ;
  delete from p12_sfull.S98_S_livechat
;
;
insert into p12_sfull.S98_S_livechat
(	 conference_id  
	, chat_creation_date  
	, chat_start_date  
	, chat_start_url  
	, referrer  
	, chat_duration  
	, queue_duration  
	, visitor_livechat_id  
	, visitor_nick  
	, visitor_ip  
	, visitor_email  
	, last_operator_id  
	, group_id  
	, group_name  
	, rate  
	, last_rate_comment  
	, operator_1_nick  
	, operator_2_nick  
	, operator_3_nick  
	, operator_4_nick  
	, operator_5_nick  
	, operator_6_nick  
	, operator_7_nick  
	, operator_8_nick  
	, operator_9_nick  
	, operator_10_nick  
	, operator_11_nick  
	, operator_1_id  
	, operator_2_id  
	, operator_3_id  
	, operator_4_id  
	, operator_5_id  
	, operator_6_id  
	, operator_7_id  
	, operator_8_id  
	, operator_9_id  
	, operator_10_id  
	, operator_11_id  
	, operator_1_time_zone  
	, operator_2_time_zone  
	, operator_3_time_zone  
	, operator_4_time_zone  
	, operator_5_time_zone  
	, operator_6_time_zone  
	, operator_7_time_zone  
	, operator_8_time_zone  
	, operator_9_time_zone  
	, operator_10_time_zone  
	, operator_11_time_zone  
	, pre_chat_service  
	, pre_chat_name  
	, pre_chat_contact  
	, pre_chat_email  
	, pre_chat_company  
	, pre_chat_service_t  
	, pre_chat_email_t  
	, pre_chat_contact_t  
	, pre_chat_company_t  
	, pre_chat_name_j  
	, pre_chat_email_j  
	, pre_chat_private_policy  
	, pre_chat_know_policy  
	, pre_chat_agree_policy  
	, pre_chat_agree_policy_k  
	, pre_chat_agree_for_sale  
	, pre_chat_company_k  
	, pre_chat_name_k  
	, pre_chat_contact_k  
	, pre_chat_email_k  
	, pre_chat_service_k  
	, pre_chat_contact_2  
	, pre_chat_contact_3  
	, post_chat_first  
	, post_chat_where_chat  
	, post_chat_help  
	, post_chat_where_2  
	, post_chat_first_j  
	, post_chat_help_j  
	, post_chat_message_j  
	, auto_invite_url  
	, auto_invite_action  
	, goal_action_name  
	, goal_done_by  
	, goal_done_date  
	, tag_1  
	, tag_2  
	, tag_3  
	, tag_4  
	, tag_5  
	, cust_var_1_name  
	, cust_var_1_value  
	, first_response_time  
	, average_response_time  
	, agents_chatting_duration  
	, visitor_user_agent  
	, group_status_at_start  
	, visitor_country_code  
	, etl_tx_dt   )
  select 
	 conference_id  
	, chat_creation_date  
	, chat_start_date  
	, chat_start_url  
	, referrer  
	, chat_duration  
	, queue_duration  
	, visitor_livechat_id  
	, visitor_nick  
	, visitor_ip  
	, visitor_email  
	, last_operator_id  
	, group_id  
	, group_name  
	, rate  
	, last_rate_comment  
	, operator_1_nick  
	, operator_2_nick  
	, operator_3_nick  
	, operator_4_nick  
	, operator_5_nick  
	, operator_6_nick  
	, operator_7_nick  
	, operator_8_nick  
	, operator_9_nick  
	, operator_10_nick  
	, operator_11_nick  
	, operator_1_id  
	, operator_2_id  
	, operator_3_id  
	, operator_4_id  
	, operator_5_id  
	, operator_6_id  
	, operator_7_id  
	, operator_8_id  
	, operator_9_id  
	, operator_10_id  
	, operator_11_id  
	, operator_1_time_zone  
	, operator_2_time_zone  
	, operator_3_time_zone  
	, operator_4_time_zone  
	, operator_5_time_zone  
	, operator_6_time_zone  
	, operator_7_time_zone  
	, operator_8_time_zone  
	, operator_9_time_zone  
	, operator_10_time_zone  
	, operator_11_time_zone  
	, pre_chat_service  
	, pre_chat_name  
	, pre_chat_contact  
	, pre_chat_email  
	, pre_chat_company  
	, pre_chat_service_t  
	, pre_chat_email_t  
	, pre_chat_contact_t  
	, pre_chat_company_t  
	, pre_chat_name_j  
	, pre_chat_email_j  
	, pre_chat_private_policy  
	, pre_chat_know_policy  
	, pre_chat_agree_policy  
	, pre_chat_agree_policy_k  
	, pre_chat_agree_for_sale  
	, pre_chat_company_k  
	, pre_chat_name_k  
	, pre_chat_contact_k  
	, pre_chat_email_k  
	, pre_chat_service_k  
	, pre_chat_contact_2  
	, pre_chat_contact_3  
	, post_chat_first  
	, post_chat_where_chat  
	, post_chat_help  
	, post_chat_where_2  
	, post_chat_first_j  
	, post_chat_help_j  
	, post_chat_message_j  
	, auto_invite_url  
	, auto_invite_action  
	, goal_action_name  
	, goal_done_by  
	, goal_done_date  
	, tag_1  
	, tag_2  
	, tag_3  
	, tag_4  
	, tag_5  
	, cust_var_1_name  
	, cust_var_1_value  
	, first_response_time  
	, average_response_time  
	, agents_chatting_duration  
	, visitor_user_agent  
	, group_status_at_start  
	, visitor_country_code  
	, etl_tx_dt  
  from p10_sa.S98_S_livechat
;
\q