sql files

This commit is contained in:
dheepa
2021-07-02 08:40:37 +00:00
commit a0d3257be0
154 changed files with 49773 additions and 0 deletions

View File

@@ -0,0 +1,335 @@
--drop function if exists fw_core.fn_run_check_count();
CREATE or REPLACE FUNCTION fw_core.fn_run_check_count(p_client_id int,p_function_id int,p_job_id int,p_step_id int)
RETURNS void
LANGUAGE plpgsql
AS $function$
declare p_date date := now() - INTERVAL '5min';
declare __client_id int :=p_client_id;
declare __function_id int :=p_function_id;
declare __file_mnemonic text := null;
declare __file_sheet_mnemonic text :=null;
declare __file_syspk int := null;
declare __jobid int := p_job_id;
declare __stepid int := p_step_id;
declare err_state text;
declare err_msg text;
declare err_detail text;
declare err_hint text;
declare err_context text;
begin
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_brake_perf_parking_brake_test_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_brake_perf_parking_brake_test_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_brake_perf_service_brake_test_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_brake_perf_service_brake_test_results a where a.create_timestamp::timestamp >=p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_centre_of_gravity_location',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_centre_of_gravity_location a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_drawbar_perf_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_drawbar_perf_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_field_perf_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_field_perf_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_haulage_perf_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_haulage_perf_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_hydraulic_lifting_capacity_test_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_hydraulic_lifting_capacity_test_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_hydraulic_maint_of_lift_load_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_hydraulic_maint_of_lift_load_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_hydraulic_power_test_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_hydraulic_power_test_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_noise_atmospheric_conditions',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_noise_atmospheric_conditions a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_noise_measurement_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_noise_measurement_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_pto_perf_results_details',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_pto_perf_results_details a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_pto_perf_results_summary',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_pto_perf_results_summary a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_test_observations',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_test_observations a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'budni_vibration_measurement',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.budni_vibration_measurement a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'drawbar_perf_observations',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.drawbar_perf_observations a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'drawbar_perf_oecd_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.drawbar_perf_oecd_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'drawbar_perf_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.drawbar_perf_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'drawbar_perf_results_summary',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.drawbar_perf_results_summary a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'field_perf_summary',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.field_perf_summary a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
--insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'field_perf_summary_implement_info',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.field_perf_summary_implement_info a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'field_perf_summary_tractor_info',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.field_perf_summary_tractor_info a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
--insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'field_perf_summary_trailer_info',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.field_perf_summary_trailer_info a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_brake_pedal_effort',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_brake_pedal_effort a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_brake_perf_test_condition',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_brake_perf_test_condition a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_brake_perf_test_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_brake_perf_test_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_cgm_lifting_angle_load_details',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_cgm_lifting_angle_load_details a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_cgm_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_cgm_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_clutch_pedal_effort',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_clutch_pedal_effort a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_gear_effort',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_gear_effort a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_gear_max_speed',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_gear_max_speed a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_hot_air_mapping_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_hot_air_mapping_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_hyd_lift_sensitivity',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_hyd_lift_sensitivity a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_noise_measurement_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_noise_measurement_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_noise_measurement_test',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_noise_measurement_test a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_pedal_effort',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_pedal_effort a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_speed_lead_lag_measurement',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_speed_lead_lag_measurement a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_steering_effort',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_steering_effort a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'iht_steering_effort_raw_data',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.iht_steering_effort_raw_data a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'pto_engine_oil_consumption',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.pto_engine_oil_consumption a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'pto_key_perf_parameters',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.pto_key_perf_parameters a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'pto_multipoint_mapping',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.pto_multipoint_mapping a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'pto_perf_governing_graph',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.pto_perf_governing_graph a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'pto_perf_results',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.pto_perf_results a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'pto_smoke_test',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.pto_smoke_test a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_atmospheric_info',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_atmospheric_info a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_drawbar_info',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_drawbar_info a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_engine_info',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_engine_info a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_equipment_info',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_equipment_info a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_fuel_lubricant_info',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_fuel_lubricant_info a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_gear_speed_chart',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_gear_speed_chart a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
--insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_images',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_images a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
--insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_implement_info',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_implement_info a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_measurement_uncertainty',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_measurement_uncertainty a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_tractor_info',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_tractor_info a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_tractor_info_misc',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_tractor_info_misc a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
--insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_trailer_info',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_trailer_info a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_tyre_info',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_tyre_info a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_weight_reaction',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_weight_reaction a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_model_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,tractor_name,row_count) select 'test_instance_wheels_info',file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model,count(*) from transactional.test_instance_wheels_info a where a.create_timestamp::timestamp >= p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic,tractor_model;
insert into fw_core.check_mnemonic_count(table_name,syspks,file_mnemonic,file_sheet_mnemonic,row_count)
SELECT table_name, syspks, file_mnemonic, file_sheet_mnemonic,sum(row_count)
FROM fw_core.check_model_count
where create_timestamp::timestamp >= p_date
group by table_name, syspks, file_mnemonic, file_sheet_mnemonic;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_arc_perf_atmos_meas_test_block',count(*) from staging2.budni_arc_perf_atmos_meas_test_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_arc_spec_h1_block',count(*) from staging2.budni_arc_spec_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_arc_test_obs_summary_block',count(*) from staging2.budni_arc_test_obs_summary_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_brk_other_observations_block',count(*) from staging2.budni_brk_other_observations_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_brk_parking_barke_test_block',count(*) from staging2.budni_brk_parking_barke_test_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_brk_service_cold_ballasted_25kmph_block',count(*) from staging2.budni_brk_service_cold_ballasted_25kmph_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_brk_service_cold_ballasted_maximum_block',count(*) from staging2.budni_brk_service_cold_ballasted_maximum_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_brk_service_cold_standard_25kmph_block',count(*) from staging2.budni_brk_service_cold_standard_25kmph_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_brk_service_cold_standard_maximum_block',count(*) from staging2.budni_brk_service_cold_standard_maximum_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_brk_service_fade_ballasted_25kmph_block',count(*) from staging2.budni_brk_service_fade_ballasted_25kmph_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_brk_service_fade_standard_maximum_block',count(*) from staging2.budni_brk_service_fade_standard_maximum_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_brk_spec_h1_block',count(*) from staging2.budni_brk_spec_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_brk_test_obs_summary_block',count(*) from staging2.budni_brk_test_obs_summary_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_dbp_drawbar_perf_block',count(*) from staging2.budni_dbp_drawbar_perf_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_dbp_spec_h1_block',count(*) from staging2.budni_dbp_spec_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_fld_cage_wheel_block',count(*) from staging2.budni_fld_cage_wheel_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_fld_impl_test_block',count(*) from staging2.budni_fld_impl_test_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_fld_spec_h1_block',count(*) from staging2.budni_fld_spec_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_fld_sum_perf_test_block',count(*) from staging2.budni_fld_sum_perf_test_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_fld_test_obs_summary_block',count(*) from staging2.budni_fld_test_obs_summary_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_hdl_lifting_capacity_test_block',count(*) from staging2.budni_hdl_lifting_capacity_test_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_hdl_maintenance_of_lift_load_block',count(*) from staging2.budni_hdl_maintenance_of_lift_load_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_hdl_power_test_block',count(*) from staging2.budni_hdl_power_test_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_hdl_spec_h1_block',count(*) from staging2.budni_hdl_spec_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_hdl_test_obs_summary_block',count(*) from staging2.budni_hdl_test_obs_summary_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_hlg_perf_test_block',count(*) from staging2.budni_hlg_perf_test_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_hlg_spec_h1_block',count(*) from staging2.budni_hlg_spec_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_hlg_test_obs_summary_block',count(*) from staging2.budni_hlg_test_obs_summary_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_lcg_gravity_test_block',count(*) from staging2.budni_lcg_gravity_test_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_lcg_spec_h1_block',count(*) from staging2.budni_lcg_spec_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_atmos_cond_2_block',count(*) from staging2.budni_nmt_atmos_cond_2_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_meas_results_1_block',count(*) from staging2.budni_nmt_meas_results_1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_meas_results_2_block',count(*) from staging2.budni_nmt_meas_results_2_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_noise_at_bystander_position_block',count(*) from staging2.budni_nmt_noise_at_bystander_position_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_noise_at_operator_ear_level_block',count(*) from staging2.budni_nmt_noise_at_operator_ear_level_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_spec_h1_block',count(*) from staging2.budni_nmt_spec_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_test_obs_summary_block',count(*) from staging2.budni_nmt_test_obs_summary_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_pto_mmtkeyword1_block',count(*) from staging2.budni_pto_mmtkeyword1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_pto_mmtkeyword2_block',count(*) from staging2.budni_pto_mmtkeyword2_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_pto_perf_report_block',count(*) from staging2.budni_pto_perf_report_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_pto_spec_h1_block',count(*) from staging2.budni_pto_spec_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_pto_summary_block',count(*) from staging2.budni_pto_summary_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_vmt_perf_meas_test_block',count(*) from staging2.budni_vmt_perf_meas_test_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_vmt_spec_h1_block',count(*) from staging2.budni_vmt_spec_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_vmt_test_obs_summary_block',count(*) from staging2.budni_vmt_test_obs_summary_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_drawbar_performance_fuel_consumption_block',count(*) from staging2.dboecd_test_drawbar_performance_fuel_consumption_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_drawbar_performance_gear_performance_block',count(*) from staging2.dboecd_test_drawbar_performance_gear_performance_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_drawbar_performance_selected_summary_block',count(*) from staging2.dboecd_test_drawbar_performance_selected_summary_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_engine_rpm_engine_to_pto_block',count(*) from staging2.dboecd_test_engine_rpm_engine_to_pto_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_engine_rpm_required_pull_block',count(*) from staging2.dboecd_test_engine_rpm_required_pull_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_engine_rpm_rpm_block',count(*) from staging2.dboecd_test_engine_rpm_rpm_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_engine_rpm_tyre_details_block',count(*) from staging2.dboecd_test_engine_rpm_tyre_details_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_engine_rpm_weight_block',count(*) from staging2.dboecd_test_engine_rpm_weight_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_h1_block',count(*) from staging2.dboecd_test_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_measurement_uncertainty_block',count(*) from staging2.dboecd_test_measurement_uncertainty_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_remarks_block',count(*) from staging2.dboecd_test_remarks_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_remarks_footer_block',count(*) from staging2.dboecd_test_remarks_footer_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_test_condition_block',count(*) from staging2.dboecd_test_test_condition_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_test_equipment_used_block',count(*) from staging2.dboecd_test_test_equipment_used_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_tractor_specifications_cleaner_block',count(*) from staging2.dboecd_test_tractor_specifications_cleaner_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_tractor_specifications_cylinders_block',count(*) from staging2.dboecd_test_tractor_specifications_cylinders_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_tractor_specifications_engine_details_block',count(*) from staging2.dboecd_test_tractor_specifications_engine_details_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_tractor_specifications_fuel_and_injection_block',count(*) from staging2.dboecd_test_tractor_specifications_fuel_and_injection_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_transmission_clutch_block',count(*) from staging2.dboecd_test_transmission_clutch_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_transmission_drawbar_block',count(*) from staging2.dboecd_test_transmission_drawbar_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_transmission_fuel_lubricant_block',count(*) from staging2.dboecd_test_transmission_fuel_lubricant_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_transmission_speed_chart_block',count(*) from staging2.dboecd_test_transmission_speed_chart_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_transmission_speed_chart_desc_block',count(*) from staging2.dboecd_test_transmission_speed_chart_desc_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_transmission_wheels_block',count(*) from staging2.dboecd_test_transmission_wheels_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_drawbar_performance_gear_performance_block',count(*) from staging2.dbstd_test_drawbar_performance_gear_performance_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_drawbar_performance_selected_summary_block',count(*) from staging2.dbstd_test_drawbar_performance_selected_summary_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_engine_rpm_engine_to_pto_block',count(*) from staging2.dbstd_test_engine_rpm_engine_to_pto_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_engine_rpm_required_pull_block',count(*) from staging2.dbstd_test_engine_rpm_required_pull_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_engine_rpm_rpm_block',count(*) from staging2.dbstd_test_engine_rpm_rpm_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_engine_rpm_tyre_details_block',count(*) from staging2.dbstd_test_engine_rpm_tyre_details_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_engine_rpm_weight_block',count(*) from staging2.dbstd_test_engine_rpm_weight_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_h1_block',count(*) from staging2.dbstd_test_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_measurement_uncertainty_block',count(*) from staging2.dbstd_test_measurement_uncertainty_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_remarks_block',count(*) from staging2.dbstd_test_remarks_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_remarks_footer_block',count(*) from staging2.dbstd_test_remarks_footer_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_test_condition_block',count(*) from staging2.dbstd_test_test_condition_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_test_equipment_used_block',count(*) from staging2.dbstd_test_test_equipment_used_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_tractor_specifications_cleaner_block',count(*) from staging2.dbstd_test_tractor_specifications_cleaner_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_tractor_specifications_cylinders_block',count(*) from staging2.dbstd_test_tractor_specifications_cylinders_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_tractor_specifications_engine_details_block',count(*) from staging2.dbstd_test_tractor_specifications_engine_details_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_tractor_specifications_fuel_and_injection_block',count(*) from staging2.dbstd_test_tractor_specifications_fuel_and_injection_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_transmission_clutch_block',count(*) from staging2.dbstd_test_transmission_clutch_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_transmission_drawbar_block',count(*) from staging2.dbstd_test_transmission_drawbar_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_transmission_fuel_lubricant_block',count(*) from staging2.dbstd_test_transmission_fuel_lubricant_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_transmission_speed_chart_block',count(*) from staging2.dbstd_test_transmission_speed_chart_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_transmission_speed_chart_desc_block',count(*) from staging2.dbstd_test_transmission_speed_chart_desc_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_transmission_wheels_block',count(*) from staging2.dbstd_test_transmission_wheels_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftdry_sum_comments_by_block',count(*) from staging2.ftdry_sum_comments_by_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftdry_sum_implement_block',count(*) from staging2.ftdry_sum_implement_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftdry_sum_test_condition_1_block',count(*) from staging2.ftdry_sum_test_condition_1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftdry_sum_test_condition_2_block',count(*) from staging2.ftdry_sum_test_condition_2_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftdry_sum_trac_h1_block',count(*) from staging2.ftdry_sum_trac_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftdry_trs_engine_rpm_block',count(*) from staging2.ftdry_trs_engine_rpm_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftdry_trs_h1_block',count(*) from staging2.ftdry_trs_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftdry_trs_implement_block',count(*) from staging2.ftdry_trs_implement_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftdry_trs_spec_block',count(*) from staging2.ftdry_trs_spec_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','fthlg_sum_comments_by_block',count(*) from staging2.fthlg_sum_comments_by_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','fthlg_sum_test_condition_1_block',count(*) from staging2.fthlg_sum_test_condition_1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','fthlg_sum_test_condition_2_block',count(*) from staging2.fthlg_sum_test_condition_2_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','fthlg_sum_trac_h1_block',count(*) from staging2.fthlg_sum_trac_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','fthlg_sum_trail_type_block',count(*) from staging2.fthlg_sum_trail_type_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','fthlg_trs_engine_rpm_block',count(*) from staging2.fthlg_trs_engine_rpm_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','fthlg_trs_h1_block',count(*) from staging2.fthlg_trs_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','fthlg_trs_spec_block',count(*) from staging2.fthlg_trs_spec_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','fthlg_trs_trailer_block',count(*) from staging2.fthlg_trs_trailer_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftwet_sum_cage_wheel_block',count(*) from staging2.ftwet_sum_cage_wheel_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftwet_sum_comments_by_block',count(*) from staging2.ftwet_sum_comments_by_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftwet_sum_implement_block',count(*) from staging2.ftwet_sum_implement_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftwet_sum_test_condition_block',count(*) from staging2.ftwet_sum_test_condition_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftwet_sum_trac_h1_block',count(*) from staging2.ftwet_sum_trac_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftwet_trs_engine_rpm_block',count(*) from staging2.ftwet_trs_engine_rpm_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftwet_trs_h1_block',count(*) from staging2.ftwet_trs_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftwet_trs_implement_block',count(*) from staging2.ftwet_trs_implement_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ftwet_trs_spec_block',count(*) from staging2.ftwet_trs_spec_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_footer_block',count(*) from staging2.ihtbt30_bt30_footer_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_h1_block',count(*) from staging2.ihtbt30_bt30_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_test_condition_block',count(*) from staging2.ihtbt30_bt30_test_condition_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_test_res_1_block',count(*) from staging2.ihtbt30_bt30_test_res_1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_test_res_2_block',count(*) from staging2.ihtbt30_bt30_test_res_2_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_test_res_3_block',count(*) from staging2.ihtbt30_bt30_test_res_3_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_test_res_4_block',count(*) from staging2.ihtbt30_bt30_test_res_4_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_tyre_details_block',count(*) from staging2.ihtbt30_bt30_tyre_details_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_weight_block',count(*) from staging2.ihtbt30_bt30_weight_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_footer_block',count(*) from staging2.ihtbt50_bt50_footer_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_h1_block',count(*) from staging2.ihtbt50_bt50_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_test_condition_block',count(*) from staging2.ihtbt50_bt50_test_condition_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_test_res_1_block',count(*) from staging2.ihtbt50_bt50_test_res_1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_test_res_2_block',count(*) from staging2.ihtbt50_bt50_test_res_2_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_test_res_3_block',count(*) from staging2.ihtbt50_bt50_test_res_3_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_test_res_4_block',count(*) from staging2.ihtbt50_bt50_test_res_4_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_tyre_details_block',count(*) from staging2.ihtbt50_bt50_tyre_details_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_weight_block',count(*) from staging2.ihtbt50_bt50_weight_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_footer_block',count(*) from staging2.ihtbtd_btd_footer_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_h1_block',count(*) from staging2.ihtbtd_btd_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_condition_block',count(*) from staging2.ihtbtd_btd_test_condition_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_res_1_block',count(*) from staging2.ihtbtd_btd_test_res_1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_res_2_block',count(*) from staging2.ihtbtd_btd_test_res_2_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_res_3_block',count(*) from staging2.ihtbtd_btd_test_res_3_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_res_4_block',count(*) from staging2.ihtbtd_btd_test_res_4_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_res_5_block',count(*) from staging2.ihtbtd_btd_test_res_5_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_res_6_block',count(*) from staging2.ihtbtd_btd_test_res_6_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_tyre_details_block',count(*) from staging2.ihtbtd_btd_tyre_details_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_weight_block',count(*) from staging2.ihtbtd_btd_weight_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_footer_block',count(*) from staging2.ihtcgm_cgm_footer_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_h1_block',count(*) from staging2.ihtcgm_cgm_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_lifting_block',count(*) from staging2.ihtcgm_cgm_lifting_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_results_block',count(*) from staging2.ihtcgm_cgm_results_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_tyre_details_block',count(*) from staging2.ihtcgm_cgm_tyre_details_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_weight_block',count(*) from staging2.ihtcgm_cgm_weight_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_wheel_block',count(*) from staging2.ihtcgm_cgm_wheel_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_brake_pedal_block',count(*) from staging2.ihtemt_emt_brake_pedal_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_footer_block',count(*) from staging2.ihtemt_emt_footer_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_h1_block',count(*) from staging2.ihtemt_emt_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_pedal_block',count(*) from staging2.ihtemt_emt_pedal_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_steering_block',count(*) from staging2.ihtemt_emt_steering_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_tyre_details_block',count(*) from staging2.ihtemt_emt_tyre_details_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_weight_block',count(*) from staging2.ihtemt_emt_weight_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_wheel_block',count(*) from staging2.ihtemt_emt_wheel_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtemt_std_raw_data_block',count(*) from staging2.ihtemt_std_raw_data_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_atmos_cond_block',count(*) from staging2.ihtham_ham_atmos_cond_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_drawbar_block',count(*) from staging2.ihtham_ham_drawbar_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_engine_rpm_block',count(*) from staging2.ihtham_ham_engine_rpm_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_footer_block',count(*) from staging2.ihtham_ham_footer_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_h1_block',count(*) from staging2.ihtham_ham_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_results_block',count(*) from staging2.ihtham_ham_results_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_tractor_block',count(*) from staging2.ihtham_ham_tractor_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_tyre_details_block',count(*) from staging2.ihtham_ham_tyre_details_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_weight_block',count(*) from staging2.ihtham_ham_weight_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihthls_hls_footer_block',count(*) from staging2.ihthls_hls_footer_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihthls_hls_h1_block',count(*) from staging2.ihthls_hls_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihthls_hls_numeric_block',count(*) from staging2.ihthls_hls_numeric_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihthls_hls_tyre_details_block',count(*) from staging2.ihthls_hls_tyre_details_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihthls_hls_weight_block',count(*) from staging2.ihthls_hls_weight_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihthls_hls_wheel_block',count(*) from staging2.ihthls_hls_wheel_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_atmos_cond_block',count(*) from staging2.ihtnst_nst_atmos_cond_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_engine_rpm_block',count(*) from staging2.ihtnst_nst_engine_rpm_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_footer_block',count(*) from staging2.ihtnst_nst_footer_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_h1_block',count(*) from staging2.ihtnst_nst_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_oel_noise_block',count(*) from staging2.ihtnst_nst_oel_noise_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_oel_noise_load_block',count(*) from staging2.ihtnst_nst_oel_noise_load_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_stand_noise_block',count(*) from staging2.ihtnst_nst_stand_noise_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_tyre_details_block',count(*) from staging2.ihtnst_nst_tyre_details_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_weight_block',count(*) from staging2.ihtnst_nst_weight_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_footer_block',count(*) from staging2.ihtsll_sll_footer_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_forward_block',count(*) from staging2.ihtsll_sll_forward_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_h1_block',count(*) from staging2.ihtsll_sll_h1_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_lead_lag_block',count(*) from staging2.ihtsll_sll_lead_lag_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_reverse_block',count(*) from staging2.ihtsll_sll_reverse_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_tyre_details_block',count(*) from staging2.ihtsll_sll_tyre_details_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_weight_block',count(*) from staging2.ihtsll_sll_weight_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_wheel_block',count(*) from staging2.ihtsll_sll_wheel_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ptoben_gvg_performance_governing_trails_block',count(*) from staging2.ptoben_gvg_performance_governing_trails_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ptoben_mpm_performance_boost_natural_block',count(*) from staging2.ptoben_mpm_performance_boost_natural_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_2hrs_max_power_natural_ambient_block',count(*) from staging2.ptoben_prf_2hrs_max_power_natural_ambient_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_2hrs_max_power_test_high_ambient_block',count(*) from staging2.ptoben_prf_2hrs_max_power_test_high_ambient_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_engine_oil_consumption_block',count(*) from staging2.ptoben_prf_engine_oil_consumption_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_key_performance_parameters_block',count(*) from staging2.ptoben_prf_key_performance_parameters_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_smoke_test_block',count(*) from staging2.ptoben_prf_smoke_test_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_tractor_specs_block',count(*) from staging2.ptoben_prf_tractor_specs_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_varying_load_rated_rpm_block',count(*) from staging2.ptoben_prf_varying_load_rated_rpm_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_varying_load_std_pto_block',count(*) from staging2.ptoben_prf_varying_load_std_pto_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_varying_speed_natural_ambient_block',count(*) from staging2.ptoben_prf_varying_speed_natural_ambient_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_varying_speed_test_high_ambient_block',count(*) from staging2.ptoben_prf_varying_speed_test_high_ambient_block where create_time::timestamp >= p_date;
insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count)
select 'transactional',table_name, sum(row_count)
from fw_core.check_model_count
where create_timestamp::timestamp >= p_date
group by table_name;
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'check_count_completed', end_status='success',end_time= now() where job_id=__jobid and step_id=__stepid and latest_runschedule_flag='1';
perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'Check_Count', 'fn_check_count', err_state, err_msg, err_detail, err_hint, err_context,'success');
EXCEPTION when OTHERS then
err_state = returned_sqlstate, /* P0002 */
err_msg = message_text, /* No Data in FTDRY */
err_detail = pg_exception_detail, /* No data in table t_test_new */
err_hint = pg_exception_hint, /* No data error capture */
err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE*/
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'check count failed', end_status='error' ,end_time= now() where job_id=__jobid and step_id=__stepid and latest_runschedule_flag='1';
perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'Check_Count', 'fn_check_count', err_state, err_msg, err_detail, err_hint, err_context,'error');
end
$function$
;

View File

@@ -0,0 +1,61 @@
drop function if exists fw_core.fn_get_function_exception;
CREATE OR REPLACE FUNCTION fw_core.fn_get_function_exception(p_function_name text)
RETURNS void
LANGUAGE plpgsql
AS $function$
declare __client_id int ;
declare __function_id int ;
declare __file_mnemonic text ;
declare __file_sheet_mnemonic text ;
declare __file_syspk int ;
declare __fname text;
declare err_state text;
declare err_msg text;
declare err_detail text;
declare err_hint text;
declare err_context text;
declare function_query text;
declare err_function text;
declare v_function_parameter text;
declare v_function_name text;
declare v_function_name_len int;
declare v_pos_ind int;
begin
function_query := 'select ' || p_function_name;
select length(p_function_name) into v_function_name_len;
select position('(' in p_function_name) into v_pos_ind;
select substring(p_function_name,0, v_pos_ind) into v_function_name;
select substring(p_function_name, v_pos_ind + 1, v_function_name_len - v_pos_ind - 1) into v_function_parameter;
select SPLIT_PART(v_function_parameter,',',1) into __client_id;
select SPLIT_PART(v_function_parameter,',',2) into __function_id;
select SPLIT_PART(v_function_parameter,',',3) into __file_mnemonic;
select SPLIT_PART(v_function_parameter,',',4) into __file_sheet_mnemonic;
select SPLIT_PART(v_function_parameter,',',5) into __file_syspk;
select trim('''' from __file_mnemonic) into __file_mnemonic;
select trim('''' from __file_sheet_mnemonic) into __file_sheet_mnemonic;
execute function_query;
/* staging2.fn_FTDRY_TRS_Block(20,1,'FTDRY','FTDRY_TRS',100) */
EXCEPTION when OTHERS then
GET STACKED DIAGNOSTICS
err_state = returned_sqlstate, /* P0002 */
err_msg = message_text, /* No Data in FTDRY */
err_detail = pg_exception_detail, /* No data in table t_test_new */
err_hint = pg_exception_hint, /* No data error capture */
err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE
SQL statement "select staging2.fn_FTDRY_TRS_Block(20,1,'FTDRY','FTDRY_TRS',100)"
PL/pgSQL function trx.fn_get_function_exception(character varying) line 36 at EXECUTE */
if v_function_name like '%Block%' then
perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,v_function_name,'stg2', null, err_state, err_msg, err_detail, err_hint, err_context,'error');
else
perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,v_function_name,'trx', null, err_state, err_msg, err_detail, err_hint, err_context,'error');
end if;
END;
$function$

View File

@@ -0,0 +1,25 @@
DROP FUNCTION IF EXISTS fw_core.fn_insert_DB_error;
CREATE OR REPLACE FUNCTION fw_core.fn_insert_db_error( clientId int, functionId int, userId int, userName varchar, fileSyspk int,
fileFormat varchar,sheetMnemonic varchar,blockName varchar,stagType varchar, eFunction varchar, eState varchar, eMessage varchar, eDetail varchar, eHint varchar,eContext varchar, sta varchar)
RETURNS text AS $$
DECLARE
_message_text text;
_returned_sqlstate text;
BEGIN
BEGIN
INSERT INTO fw_core.DB_Run_Status ( client_Id, function_id, user_id, user_name, file_syspk, file_mnemonic, file_sheet_mnemonic, block_name, staging_type, error_function, error_state, error_message, error_detail, error_hint, error_context,status)
values ( clientId, functionId, userID, userName, fileSyspk, fileFormat, sheetMnemonic, blockName, stagType, eFunction, eState, eMessage, eDetail, eHInt, eContext, sta );
EXCEPTION when OTHERS THEN
_message_text := '';
_returned_sqlstate := '';
GET STACKED DIAGNOSTICS
_message_text = MESSAGE_TEXT,
_returned_sqlstate = RETURNED_SQLSTATE;
RETURN 'Failed: DB Error Creation : ' || _returned_sqlstate || ' : ' || _message_text;
END;
RETURN 'Success: DB Error Creation ';
END
$$ LANGUAGE plpgsql;

View File

@@ -0,0 +1,69 @@
--drop function if exists fn_info_column_dq();
CREATE OR REPLACE function fn_info_column_dq(schemaname text)
RETURNS void AS $$
declare
statements text;
begin
/************************************************************
Function Name:fn_info_column_dq
Function Desc: This function populates data into given schema. This function creates temporary table which stores SQL queires
and later through for loop each temporary sql statement is executed.
Function concept: uses concat method to create a insert statement, 2 different statements are provided (choose any).
Creation Date: 06-June-2021
Updation Date:
Author: compegence team
Function Call: select fn_info_column_dq('transactional');
Data Access: select * from info_column_dq;
***************************************************************/
-- Accessing information from information_schema and computing the required data
-- Storing the data in config db table
-- Execute this if the table does not exits or when the db is new
execute 'SET search_path to '''||schemaname||'''';
DROP table if exists info_column_dq;
create table info_column_dq (
table_schema text null,
table_name text NULL,
column_name text NULL,
column_data_type text NULL,
column_unique_count int null,
column_min_value text null,
column_max_value text null,
column_null_count int null,
create_timestamp timestamp not NULL DEFAULT CURRENT_TIMESTAMP
);
-- Temporary table to store queries : create
--drop table if exists queries;
create temp table queries (sqlquery text null);
-- Temporary table to store queries : insert data
insert into queries(sqlquery)
select
-- without using time-stamp::Date:
concat('insert into info_column_dq(table_schema,table_name,column_name,column_data_type,column_unique_count,column_min_value,column_max_value,column_null_count) select ''',c.table_schema,''',''',c.table_name,''',''', c.column_name,''',''', c.data_type,''',','count(distinct ',c.column_name,'),','min(',c.column_name,'),','max(',c.column_name,'),','SUM(CASE WHEN ',c.column_name ,' IS NULL THEN 1 ELSE 0 END) from ',c.table_schema,'.',c.table_name,';')
-- with using time-stamp::Date:
--concat('insert into info_column_dq(table_schema,table_name,column_name,column_data_type,column_unique_count,column_min_value,column_max_value,column_null_count) select ''',c.table_schema,''',''',c.table_name,''',''', c.column_name,''',''', c.data_type,''',','count(distinct ',c.column_name,'),','min(',c.column_name,'),','max(',c.column_name,'),','SUM(CASE WHEN ',c.column_name ,' IS NULL THEN 1 ELSE 0 END) from ',c.table_schema,'.',c.table_name,' where create_timestamp :: date >= now() ::Date;')
from information_schema."columns" c
where c.table_schema in (''||schemaname||'')
and c.table_name != 'info_column_dq'
and not c.data_type in ('bytea','boolean');
--and c.table_name !='test_instance_images'
--and not c.column_name in ('create_timestamp','update_timestamp');
-- executing the stored queries from temporary queries table: Loop the column data and execute each statement
for statements in select sqlquery from queries
loop
execute(statements);
end loop;
end;
$$ LANGUAGE plpgsql;
/*
select fn_info_column_dq('transactional');
select * from info_column_dq;
--gives error
--insert into fw_core.info_column_dq(table_schema,table_name,column_name,column_data_type,column_unique_count,column_min_value,column_max_value) select 'transactional','test_instance_images','image','bytea',count(distinct image),min(image),max(image) from transactional.test_instance_images;
*/

View File

@@ -0,0 +1,14 @@
drop function if exists fw_core.fn_jobctl_block_begin;
CREATE OR REPLACE FUNCTION fw_core.fn_jobctl_block_begin(p_client_id int,p_function_id int,p_file_syspk int,p_block_table_name text,p_file_mnemonic text,p_file_sheet_mnemonic text,p_block_seq int)
RETURNS void AS $$
begin
/*************************
select staging2.fn_jobctrl_block_begin(1,2,255,'block1','file','sheet',1)
***********************/
execute 'insert into fw_core.fw_jobctl_file_sheet_block_run_schedule
(client_id,function_id,file_syspk,block_table_name,file_mnemonic,file_sheet_mnemonic,begin_status,block_table_load_seq,start_time)
select '||p_client_id||', '||p_function_id||', '''||p_file_syspk||''','''||p_block_table_name||''','''||p_file_mnemonic||''','''||p_file_sheet_mnemonic||''',1,'||p_block_seq||',current_timestamp';
end
$$ LANGUAGE plpgsql;

View File

@@ -0,0 +1,14 @@
drop function if exists fw_core.fn_jobctl_block_end;
CREATE OR REPLACE FUNCTION fw_core.fn_jobctl_block_end(p_file_syspk int,p_block_table_name text)
RETURNS void AS $$
begin
/*********************************
select staging2.fn_jobctrl_block_end(255,'block1')
*********************************/
execute 'update fw_core.fw_jobctl_file_sheet_block_run_schedule set end_status=1 , end_time=now(), end_status_note=''completed''
where file_syspk='''||p_file_syspk||'''and block_table_name='''||p_block_table_name||'''';
end
$$ LANGUAGE plpgsql;

View File

@@ -0,0 +1,142 @@
drop function if exists fw_core.fn_run_post_generic_validation;
CREATE OR REPLACE FUNCTION fw_core.fn_run_post_generic_validation(p_client_id int,p_function_id int,p_job_id int,p_step_id int)
RETURNS void AS $$
declare
f record;
trx_record_count int;
keyword_match_count int;
missing_sheet_count int;
success_sum int;
w_job_id int := p_job_id;
w_step_id int := p_step_id;
-- validate file already loaded in the Transactional DB :
begin
for f in select distinct file_syspk from fw_core.fw_jobctl_file_runschedule
where latest_runschedule_flag = '1' and end_status != 'error' and end_status_note = 'stg1_completed'
loop
select count(*) from transactional.test_instance where file_syspk = f.file_syspk into trx_record_count;
if trx_record_count > 0 then
update fw_core.fw_jobctl_file_runschedule set end_status_note ='generic_validation_failed', end_status='error', staging_type = 'stg1',end_time = now() where file_syspk = f.file_syspk;
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'file_syspk exists', end_status='error', staging_type = 'stg1',end_time = now() where file_syspk = f.file_syspk;
end if;
update fw_core.fw_jobctl_file_runschedule set end_status_note ='generic_validation_completed', end_status='success', staging_type = 'stg1',end_time = now() where file_syspk = f.file_syspk;
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'generic_validation_completed', end_status='success', staging_type = 'stg1',end_time = now() where file_syspk = f.file_syspk and file_sheet_mnemonic is not null;
end loop;
SELECT SUM (case WHEN end_status = 'success' THEN 1
ELSE 0 END) AS "Error Sum" FROM fw_core.fw_jobctl_file_sheet_runschedule where latest_runschedule_flag = '1' INTO success_sum;
if (success_sum >0 or success_sum is null) then
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_completed', end_status='success' , end_time= now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1';
else
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_failed', end_status='error', end_time= now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1';
return ;
end if;
--insert into fw_core.track_jobstep select *,'file_syspk' from fw_core.fw_jobctl_runschedule_jobstep;
--insert into fw_core.track_file select *,'file_syspk' from fw_core.fw_jobctl_file_runschedule;
--insert into fw_core.track_file_sheet select * ,'file_syspk' from fw_core.fw_jobctl_file_sheet_runschedule;
-- validate sheet names for a given file:
for f in select distinct file_syspk,file_mnemonic,file_sheet_mnemonic from fw_core.fw_jobctl_file_sheet_runschedule
where file_sheet_mnemonic is not null
and end_status != 'error' and end_status_note = 'generic_validation_completed' and latest_runschedule_flag = '1'
loop
select count(distinct sheet_name) from fw_core.test_file_sheet_format_master
where sheet_name not in
(select distinct sheet_name from fw_core.fw_jobctl_file_sheet_runschedule where file_mnemonic in (f.file_mnemonic) and file_sheet_mnemonic is not null and file_syspk=f.file_syspk)
and file_mnemonic in (f.file_mnemonic)
into missing_sheet_count;
if missing_sheet_count = 0 then
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'generic_validation_completed', end_status='success', staging_type = 'stg1',end_time = now() where
file_syspk = f.file_syspk and file_sheet_mnemonic=f.file_sheet_mnemonic;
update fw_core.fw_jobctl_file_runschedule set end_status_note ='generic_validation_completed', end_status='success', staging_type = 'stg1',end_time = now() where file_syspk = f.file_syspk;
else
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'stg1_sheet_missing', end_status='error', staging_type = 'stg1',end_time = now() where
file_syspk = f.file_syspk and file_sheet_mnemonic=f.file_sheet_mnemonic;
update fw_core.fw_jobctl_file_runschedule set end_status_note ='generic_validation_failed', end_status='error', staging_type = 'stg1',end_time = now() where file_syspk = f.file_syspk;
end if;
end loop;
SELECT SUM (case WHEN end_status = 'success' THEN 1
ELSE 0 END) AS "Error Sum" FROM fw_core.fw_jobctl_file_sheet_runschedule where latest_runschedule_flag = '1' INTO success_sum;
if ((success_sum > 0) or (success_sum is null)) then
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_completed', end_status='success', end_time=now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1';
else
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_failed', end_status='error', end_time=now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1';
return ;
end if;
insert into fw_core.track_jobstep select *,'missing_sheet' from fw_core.fw_jobctl_runschedule_jobstep;
insert into fw_core.track_file select *,'missing_sheet' from fw_core.fw_jobctl_file_runschedule;
insert into fw_core.track_file_sheet select * ,'missing_sheet' from fw_core.fw_jobctl_file_sheet_runschedule;
-- validate keywords for a given file:
for f in select distinct file_syspk,file_mnemonic,file_sheet_mnemonic
from fw_core.fw_jobctl_file_sheet_runschedule where file_sheet_mnemonic !=''
and end_status != 'error' and end_status_note = 'generic_validation_completed'
order by file_syspk
loop
select case
when file_sheet_mnemonic in ('FTDRY_SUM','FTHLG_SUM')then count(trim(column2))-2
when file_sheet_mnemonic in ('FTWET_SUM')then count(trim(column2))-1
else count(trim(column2)) end
from staging1.staging_generic_table where column2
in (select trim(f1_keyword) from transactional.source_config a
where a.file_mnemonic=f.file_mnemonic and a.file_sheet_mnemonic=f.file_sheet_mnemonic )
and file_mnemonic=f.file_mnemonic and file_sheet_mnemonic=f.file_sheet_mnemonic and file_syspk = f.file_syspk group by file_sheet_mnemonic into keyword_match_count;
if keyword_match_count != (select count(f1_keyword) from transactional.source_config a
where a.file_mnemonic=f.file_mnemonic and a.file_sheet_mnemonic=f.file_sheet_mnemonic)
then
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'stg1_keyword_validation_failed', end_status='error', staging_type = 'stg1',end_time = now() where
file_syspk = f.file_syspk and file_sheet_mnemonic=f.file_sheet_mnemonic;
else
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'generic_validation_completed', end_status='success', staging_type = 'stg1',end_time = now() where
file_syspk = f.file_syspk and file_sheet_mnemonic=f.file_sheet_mnemonic;
end if;
end loop;
-- update fw_jobctl_file_runschedule table.
--insert into fw_core.track_jobstep select *,'keyword_' from fw_core.fw_jobctl_runschedule_jobstep;
--insert into fw_core.track_file select *,'keyword_' from fw_core.fw_jobctl_file_runschedule;
--insert into fw_core.track_file_sheet select *,'keyword_' from fw_core.fw_jobctl_file_sheet_runschedule;
--, staging_type = 'stg1'
update fw_core.fw_jobctl_file_runschedule set end_status_note = 'generic_validation_completed', end_status='success', end_time=now() from fw_core.fw_jobctl_file_sheet_runschedule a
where a.latest_runschedule_flag = '1' and a.end_status = 'success' and a.end_status_note ='generic_validation_completed' and fw_core.fw_jobctl_file_runschedule.file_syspk = a.file_syspk;
update fw_core.fw_jobctl_file_runschedule set end_status_note = 'generic_validation_failed' , end_status='error',end_time=now() from fw_core.fw_jobctl_file_sheet_runschedule a
where a.latest_runschedule_flag = '1' and a.end_status = 'error' and a.end_status_note = 'stg1_keyword_validation_failed' and fw_core.fw_jobctl_file_runschedule.file_syspk = a.file_syspk;
update fw_core.fw_jobctl_file_sheet_runschedule set end_status='error',end_status_note = 'stg1_keyword_validation_failed',end_time=now() from fw_core.fw_jobctl_file_runschedule a
where file_sheet_mnemonic is not null and a.latest_runschedule_flag = '1' and a.end_status = 'error' and a.end_status_note = 'generic_validation_failed' and fw_core.fw_jobctl_file_sheet_runschedule.file_syspk = a.file_syspk;
SELECT SUM (case WHEN end_status = 'success' THEN 1
ELSE 0 END) AS "Error Sum" FROM fw_core.fw_jobctl_file_runschedule where latest_runschedule_flag = '1' INTO success_sum;
if (success_sum >0 or success_sum is null) then
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_completed', end_status='success', end_time=now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1';
else
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_failed', end_status= 'error', end_time=now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1';
end if;
--insert into fw_core.track_jobstep select *,'keyword_missing' from fw_core.fw_jobctl_runschedule_jobstep;
--insert into fw_core.track_file select *,'keyword_missing' from fw_core.fw_jobctl_file_runschedule;
--insert into fw_core.track_file_sheet select *,'keyword_missing' from fw_core.fw_jobctl_file_sheet_runschedule;
end;
$$ LANGUAGE plpgsql;

View File

@@ -0,0 +1,34 @@
drop function if exists fw_core.fn_run_trx_post_validation;
CREATE OR REPLACE FUNCTION fw_core.fn_run_trx_post_validation(p_client_id int,p_function_id int,p_job_id int,p_step_id int)
RETURNS void AS $$
declare
f record;
trx_record_count int;
w_job_id int := p_job_id;
w_step_id int := p_step_id;
-- validate Trx data record loading:
begin
for f in select distinct file_syspk from fw_core.fw_jobctl_file_runschedule
where latest_runschedule_flag = '1' and end_status != 'error' and end_status_note = 'TRX_completed'
loop
select count(*) from transactional.test_instance where file_syspk = f.file_syspk into trx_record_count;
if (trx_record_count = 0) then
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'trx_post_validation_failed', end_status='error', end_time= now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1';
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'trx_post_validation_failed', end_status='error', end_time= now() where file_syspk=f.file_syspk;
update fw_core.fw_jobctl_file_runschedule set end_status_note = 'trx_post_validation_failed', end_status='error', end_time= now() where file_syspk=f.file_syspk;
else
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'TRX_completed', end_status='success' , end_time= now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1';
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'TRX_completed', end_status='success', end_time= now() where file_syspk=f.file_syspk;
update fw_core.fw_jobctl_file_runschedule set end_status_note = 'TRX_completed', end_status='success', end_time= now() where file_syspk=f.file_syspk;
end if;
end loop;
/*
--insert into fw_core.track_jobstep select *,'trx_validation' from fw_core.fw_jobctl_runschedule_jobstep;
--insert into fw_core.track_file select *,'trx_validation' from fw_core.fw_jobctl_file_runschedule;
--insert into fw_core.track_file_sheet select *,'trx_validation' from fw_core.fw_jobctl_file_sheet_runschedule;
*/
end;
$$ LANGUAGE plpgsql;

View File

@@ -0,0 +1,174 @@
drop function if exists fw_core.fn_run_trx_rollback;
CREATE OR REPLACE FUNCTION fw_core.fn_run_trx_rollback(p_client_id int,p_function_id int,p_job_id int,p_step_id int)
RETURNS void AS $$
declare
f record;
begin
for f in select file_syspk,file_mnemonic
from fw_core.fw_jobctl_file_runschedule where latest_runschedule_flag = '1' and end_status = 'error'
and end_status_note in ('stg2_failed','TRX_failed')
order by file_syspk
loop
if f.file_mnemonic = 'FTDRY' then
delete from transactional.test_instance where file_syspk = f.file_syspk;
delete from transactional.test_instance_engine_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_implement_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_tractor_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_trailer_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_tyre_info where file_syspk = f.file_syspk;
delete from transactional.field_perf_summary where file_syspk = f.file_syspk;
delete from transactional.field_perf_summary_implement_info where file_syspk = f.file_syspk;
delete from transactional.field_perf_summary_tractor_info where file_syspk = f.file_syspk;
elsif f.file_mnemonic = 'FTWET' then
delete from transactional.test_instance where file_syspk = f.file_syspk;
delete from transactional.test_instance_engine_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_implement_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_tractor_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_trailer_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_tyre_info where file_syspk = f.file_syspk;
delete from transactional.field_perf_summary where file_syspk = f.file_syspk;
delete from transactional.field_perf_summary_implement_info where file_syspk = f.file_syspk;
delete from transactional.field_perf_summary_tractor_info where file_syspk = f.file_syspk;
elsif f.file_mnemonic = 'FTHLG' then
delete from transactional.test_instance where file_syspk = f.file_syspk;
delete from transactional.test_instance_engine_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_implement_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_tractor_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_trailer_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_tyre_info where file_syspk = f.file_syspk;
delete from transactional.field_perf_summary where file_syspk = f.file_syspk;
delete from transactional.field_perf_summary_implement_info where file_syspk = f.file_syspk;
delete from transactional.field_perf_summary_tractor_info where file_syspk = f.file_syspk;
delete from transactional.field_perf_summary_trailer_info where file_syspk = f.file_syspk;
elsif f.file_mnemonic = 'DBSTD' then
delete from transactional.test_instance where file_syspk = f.file_syspk;
delete from transactional.test_instance_engine_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_tractor_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_drawbar_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_tyre_info where file_syspk = f.file_syspk;
delete from transactional.drawbar_perf_results_summary where file_syspk = f.file_syspk;
delete from transactional.drawbar_perf_results where file_syspk = f.file_syspk;
delete from transactional.test_instance_equipment_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_measurement_uncertainty where file_syspk = f.file_syspk;
delete from transactional.test_instance_tractor_info_misc where file_syspk = f.file_syspk;
delete from transactional.test_instance_gear_speed_chart where file_syspk = f.file_syspk;
delete from transactional.Test_instance_wheels_info where file_syspk = f.file_syspk;
delete from transactional.Test_instance_fuel_lubricant_info where file_syspk = f.file_syspk;
delete from transactional.drawbar_perf_observations where file_syspk = f.file_syspk;
elsif f.file_mnemonic = 'DBOECD' then
delete from transactional.test_instance where file_syspk = f.file_syspk;
delete from transactional.test_instance_engine_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_tractor_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_drawbar_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_tyre_info where file_syspk = f.file_syspk;
delete from transactional.drawbar_perf_results_summary where file_syspk = f.file_syspk;
delete from transactional.drawbar_perf_results where file_syspk = f.file_syspk;
delete from transactional.drawbar_perf_oecd_results where file_syspk = f.file_syspk;
delete from transactional.test_instance_equipment_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_measurement_uncertainty where file_syspk = f.file_syspk;
delete from transactional.test_instance_tractor_info_misc where file_syspk = f.file_syspk;
delete from transactional.test_instance_gear_speed_chart where file_syspk = f.file_syspk;
delete from transactional.Test_instance_wheels_info where file_syspk = f.file_syspk;
delete from transactional.Test_instance_fuel_lubricant_info where file_syspk = f.file_syspk;
delete from transactional.drawbar_perf_observations where file_syspk = f.file_syspk;
elsif f.file_mnemonic = 'PTOBEN' then
delete from transactional.pto_engine_oil_consumption where file_syspk = f.file_syspk;
delete from transactional.pto_key_perf_parameters where file_syspk = f.file_syspk;
delete from transactional.pto_multipoint_mapping where file_syspk = f.file_syspk;
delete from transactional.pto_perf_governing_graph where file_syspk = f.file_syspk;
delete from transactional.pto_perf_results where file_syspk = f.file_syspk;
delete from transactional.pto_smoke_test where file_syspk = f.file_syspk;
delete from transactional.test_instance where file_syspk = f.file_syspk;
delete from transactional.test_instance_tractor_info where file_syspk = f.file_syspk;
elsif f.file_mnemonic = 'PTOSTD' then
delete from transactional.pto_engine_oil_consumption where file_syspk = f.file_syspk;
delete from transactional.pto_key_perf_parameters where file_syspk = f.file_syspk;
delete from transactional.pto_multipoint_mapping where file_syspk = f.file_syspk;
delete from transactional.pto_perf_governing_graph where file_syspk = f.file_syspk;
delete from transactional.pto_perf_results where file_syspk = f.file_syspk;
delete from transactional.pto_smoke_test where file_syspk = f.file_syspk;
delete from transactional.test_instance where file_syspk = f.file_syspk;
delete from transactional.test_instance_tractor_info where file_syspk = f.file_syspk;
elsif f.file_mnemonic = 'BUDNI' then
delete from transactional.test_instance where file_syspk = f.file_syspk;
delete from transactional.test_instance_engine_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_tractor_info where file_syspk = f.file_syspk;
delete from transactional.budni_air_cleaner_perf_results where file_syspk = f.file_syspk;
delete from transactional.budni_test_observations where file_syspk = f.file_syspk;
delete from transactional.budni_brake_perf_parking_brake_test_results where file_syspk = f.file_syspk;
delete from transactional.budni_brake_perf_service_brake_test_results where file_syspk = f.file_syspk;
delete from transactional.budni_drawbar_perf_results where file_syspk = f.file_syspk;
delete from transactional.test_instance_implement_info where file_syspk = f.file_syspk;
delete from transactional.budni_field_perf_results where file_syspk = f.file_syspk;
delete from transactional.test_instance_tractor_info_misc where file_syspk = f.file_syspk;
delete from transactional.budni_hydraulic_maint_of_lift_load_results where file_syspk = f.file_syspk;
delete from transactional.budni_hydraulic_power_test_results where file_syspk = f.file_syspk;
delete from transactional.budni_hydraulic_lifting_capacity_test_results where file_syspk = f.file_syspk;
delete from transactional.budni_centre_of_gravity_location where file_syspk = f.file_syspk;
delete from transactional.budni_noise_atmospheric_conditions where file_syspk = f.file_syspk;
delete from transactional.budni_noise_measurement_results where file_syspk = f.file_syspk;
delete from transactional.budni_pto_perf_results_summary where file_syspk = f.file_syspk;
delete from transactional.budni_pto_perf_results_details where file_syspk = f.file_syspk;
delete from transactional.budni_vibration_measurement where file_syspk = f.file_syspk;
elsif f.file_mnemonic = 'IHT' then
delete from transactional.test_instance where file_syspk = f.file_syspk;
delete from transactional.test_instance_engine_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_tyre_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_atmospheric_info where file_syspk = f.file_syspk;
delete from transactional.iht_noise_measurement_results where file_syspk = f.file_syspk;
delete from transactional.test_instance_tractor_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_drawbar_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_weight_reaction where file_syspk = f.file_syspk;
delete from transactional.iht_brake_perf_test_condition where file_syspk = f.file_syspk;
delete from transactional.iht_brake_perf_test_results where file_syspk = f.file_syspk;
delete from transactional.iht_cgm_lifting_angle_load_details where file_syspk = f.file_syspk;
delete from transactional.iht_cgm_results where file_syspk = f.file_syspk;
delete from transactional.iht_steering_effort where file_syspk = f.file_syspk;
delete from transactional.iht_pedal_effort where file_syspk = f.file_syspk;
delete from transactional.iht_clutch_pedal_effort where file_syspk = f.file_syspk;
delete from transactional.iht_brake_pedal_effort where file_syspk = f.file_syspk;
delete from transactional.iht_gear_effort where file_syspk = f.file_syspk;
delete from transactional.iht_hyd_lift_sensitivity where file_syspk = f.file_syspk;
delete from transactional.iht_noise_measurement_test where file_syspk = f.file_syspk;
delete from transactional.iht_gear_max_speed where file_syspk = f.file_syspk;
delete from transactional.iht_speed_lead_lag_measurement where file_syspk = f.file_syspk;
delete from transactional.iht_steering_effort_raw_data where file_syspk = f.file_syspk;
delete from transactional.iht_hot_air_mapping_results where file_syspk = f.file_syspk;
else
delete from transactional.test_instance where file_syspk = f.file_syspk;
delete from transactional.test_instance_engine_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_tyre_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_atmospheric_info where file_syspk = f.file_syspk;
delete from transactional.iht_noise_measurement_results where file_syspk = f.file_syspk;
delete from transactional.test_instance_tractor_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_drawbar_info where file_syspk = f.file_syspk;
delete from transactional.test_instance_weight_reaction where file_syspk = f.file_syspk;
delete from transactional.iht_brake_perf_test_condition where file_syspk = f.file_syspk;
delete from transactional.iht_brake_perf_test_results where file_syspk = f.file_syspk;
delete from transactional.iht_cgm_lifting_angle_load_details where file_syspk = f.file_syspk;
delete from transactional.iht_cgm_results where file_syspk = f.file_syspk;
delete from transactional.iht_steering_effort where file_syspk = f.file_syspk;
delete from transactional.iht_pedal_effort where file_syspk = f.file_syspk;
delete from transactional.iht_clutch_pedal_effort where file_syspk = f.file_syspk;
delete from transactional.iht_brake_pedal_effort where file_syspk = f.file_syspk;
delete from transactional.iht_gear_effort where file_syspk = f.file_syspk;
delete from transactional.iht_hyd_lift_sensitivity where file_syspk = f.file_syspk;
delete from transactional.iht_noise_measurement_test where file_syspk = f.file_syspk;
delete from transactional.iht_gear_max_speed where file_syspk = f.file_syspk;
delete from transactional.iht_speed_lead_lag_measurement where file_syspk = f.file_syspk;
delete from transactional.iht_steering_effort_raw_data where file_syspk = f.file_syspk;
delete from transactional.iht_hot_air_mapping_results where file_syspk = f.file_syspk;
end if;
end loop;
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'rollback completed', end_status='success', end_time=now() where job_id = p_job_id and step_id = p_step_id and latest_runschedule_flag = '1';
--insert into fw_core.track_jobstep select *,'roll_back' from fw_core.fw_jobctl_runschedule_jobstep;
--insert into fw_core.track_file select *,'roll_back' from fw_core.fw_jobctl_file_runschedule;
--insert into fw_core.track_file_sheet select *,'roll_back' from fw_core.fw_jobctl_file_sheet_runschedule;
end;
$$ LANGUAGE plpgsql;

View File

@@ -0,0 +1,74 @@
CREATE OR REPLACE FUNCTION fw_core.fn_update_NA(filesyspk integer)
RETURNS void
LANGUAGE plpgsql
AS $function$
/***********
select fw_core.fn_update_NA()
********/
declare
__n integer:=0;
__na_sql text;
__space_sql text;
__div_sql text;
__ref_sql text;
__hyphen_sql text;
__hyphen_3_sql text;
__not_applicable text;
__NR text;
__Dots_1 text;
__Dots_2 text;
__trail_trim_columns text;
__lead_trim_columns text;
__Dots_3 text;
__inverted_comma text;
__underscore text;
begin
loop
exit when __n=53;
__n := __n+1;
__na_sql := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null
where '||concat('column',__n)||'=''NA'' and file_syspk=' ||filesyspk;
__space_sql := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null
where '||concat('column',__n)||'='''' and file_syspk=' ||filesyspk;
__div_sql := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null
where '||concat('column',__n)||'=''#REF!'' and file_syspk=' ||filesyspk;
__ref_sql := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null
where '||concat('column',__n)||'=''#DIV/0!'' and file_syspk=' ||filesyspk;
__hyphen_sql := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null
where '||concat('column',__n)||'=''-'' and file_syspk=' ||filesyspk;
__hyphen_3_sql := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null
where '||concat('column',__n)||'=''---'' and file_syspk=' ||filesyspk;
__not_applicable := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null
where '||concat('column',__n)||'=''Not Applicable '' and file_syspk=' ||filesyspk;
__NR := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null
where '||concat('column',__n)||'=''NR'' and file_syspk=' ||filesyspk;
__Dots_1 := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null
where '||concat('column',__n)||'=''u..'' and file_syspk=' ||filesyspk;
__Dots_2 := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null
where '||concat('column',__n)||'=''u.'' and file_syspk=' ||filesyspk;
__Dots_3 := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null
where '||concat('column',__n)||'=''.'' and file_syspk=' ||filesyspk;
__inverted_comma := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null
where '||concat('column',__n)||'=''`'' and file_syspk=' ||filesyspk;
__trail_trim_columns:='update staging1.staging_generic_table set '|| concat('column',__n)||' = trim(trailing from '|| concat('column',__n)||')';
__lead_trim_columns:='update staging1.staging_generic_table set '|| concat('column',__n)||' = trim(leading from '|| concat('column',__n)||')';
__underscore := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null
where '||concat('column',__n)||'=''_'' and file_syspk=' ||filesyspk;
execute __na_sql;
execute __space_sql;
execute __div_sql;
execute __ref_sql;
execute __hyphen_sql;
execute __not_applicable;
execute __NR;
execute __Dots_1;
execute __Dots_2;
execute __trail_trim_columns;
execute __lead_trim_columns;
execute __underscore;
end loop;
end;
$function$