added new files from jagadish and vignesh folders
This commit is contained in:
160
MMT_SQL/ods/PTO-GVG_ods.txt
Normal file
160
MMT_SQL/ods/PTO-GVG_ods.txt
Normal file
@@ -0,0 +1,160 @@
|
||||
drop function if exists mmt_staging2.fn_PTO_GVG_ODS;
|
||||
CREATE OR REPLACE FUNCTION mmt_staging2.fn_PTO_GVG_ODS()
|
||||
RETURNS void AS $$
|
||||
begin
|
||||
SET search_path TO mmt_staging2;
|
||||
|
||||
|
||||
/*************************************************************
|
||||
Function Name:fn_PTO_GVG_ODS
|
||||
Function Desc: This function populates data into ODS blocks
|
||||
File Format: PTOBST
|
||||
Sheet Format: PTOBST_GVG
|
||||
Creation Date: March 21 2021
|
||||
Updation Date:
|
||||
Author: compegence team
|
||||
Function Call: select mmt_staging2.fn_PTO_GVG_ODS()
|
||||
***************************************************************/
|
||||
|
||||
|
||||
insert into mmt_ods.PTO_Perf_Governing_Graph
|
||||
(client_id,
|
||||
function_id,
|
||||
test_file_ref_no,
|
||||
tractor_model,
|
||||
tractor_make,
|
||||
test_condition,
|
||||
engine_speed_rpm,
|
||||
torque_kg_m,
|
||||
power_hp,
|
||||
sfc_gm_per_hp_hr,
|
||||
fuelling_mm3_per_stroke_per_cyl,
|
||||
test_file_format,
|
||||
test_file_sheet_format)
|
||||
select
|
||||
client_id,
|
||||
function_id,
|
||||
file_syspk,
|
||||
model,
|
||||
make,
|
||||
c1,
|
||||
c2::numeric,
|
||||
c3::numeric,
|
||||
c4::numeric,
|
||||
c5::numeric,
|
||||
c6::numeric,
|
||||
file_format,
|
||||
sheet_mnemonic
|
||||
from mmt_staging2.PTOBST_GVG_performance_governing_trails_block
|
||||
where ods_record=1
|
||||
union
|
||||
select
|
||||
client_id,
|
||||
function_id,
|
||||
file_syspk,
|
||||
model,
|
||||
make,
|
||||
c7_1,
|
||||
c7::numeric,
|
||||
c8::numeric,
|
||||
c9::numeric,
|
||||
c10::numeric,
|
||||
c11::numeric,
|
||||
file_format,
|
||||
sheet_mnemonic
|
||||
from mmt_staging2.PTOBST_GVG_performance_governing_trails_block
|
||||
where ods_record=1
|
||||
and (c7 is not null and c8 is not null and c9 is not null and c10 is not null and c11 is not null)
|
||||
union
|
||||
select
|
||||
client_id,
|
||||
function_id,
|
||||
file_syspk,
|
||||
model,
|
||||
make,
|
||||
c12_1,
|
||||
c12::numeric,
|
||||
c13::numeric,
|
||||
c14::numeric,
|
||||
c15::numeric,
|
||||
c16::numeric,
|
||||
file_format,
|
||||
sheet_mnemonic
|
||||
from mmt_staging2.PTOBST_GVG_performance_governing_trails_block
|
||||
where ods_record=1
|
||||
and (c12 is not null and c13 is not null and c14 is not null and c15 is not null and c16 is not null)
|
||||
union
|
||||
select
|
||||
client_id,
|
||||
function_id,
|
||||
file_syspk,
|
||||
model,
|
||||
make,
|
||||
c17_1,
|
||||
c17::numeric,
|
||||
c18::numeric,
|
||||
c19::numeric,
|
||||
c20::numeric,
|
||||
c21::numeric,
|
||||
file_format,
|
||||
sheet_mnemonic
|
||||
from mmt_staging2.PTOBST_GVG_performance_governing_trails_block
|
||||
where ods_record=1
|
||||
and (c17 is not null and c18 is not null and c19 is not null and c20 is not null and c21 is not null)
|
||||
union
|
||||
select
|
||||
client_id,
|
||||
function_id,
|
||||
file_syspk,
|
||||
model,
|
||||
make,
|
||||
c22_1,
|
||||
c22::numeric,
|
||||
c23::numeric,
|
||||
c24::numeric,
|
||||
c25::numeric,
|
||||
c26::numeric,
|
||||
file_format,
|
||||
sheet_mnemonic
|
||||
from mmt_staging2.PTOBST_GVG_performance_governing_trails_block
|
||||
where ods_record=1
|
||||
and (c22 is not null and c23 is not null and c24 is not null and c25 is not null and c26 is not null)
|
||||
union
|
||||
select
|
||||
client_id,
|
||||
function_id,
|
||||
file_syspk,
|
||||
model,
|
||||
make,
|
||||
c27_1,
|
||||
c27::numeric,
|
||||
c28::numeric,
|
||||
c29::numeric,
|
||||
c30::numeric,
|
||||
c31::numeric,
|
||||
file_format,
|
||||
sheet_mnemonic
|
||||
from mmt_staging2.PTOBST_GVG_performance_governing_trails_block
|
||||
where ods_record=1
|
||||
and (c27 is not null and c28 is not null and c29 is not null and c30 is not null and c32 is not null)
|
||||
union
|
||||
select
|
||||
client_id,
|
||||
function_id,
|
||||
file_syspk,
|
||||
model,
|
||||
make,
|
||||
c32_1,
|
||||
c32::numeric,
|
||||
c33::numeric,
|
||||
c34::numeric,
|
||||
c35::numeric,
|
||||
c36::numeric,
|
||||
file_format,
|
||||
sheet_mnemonic
|
||||
from mmt_staging2.PTOBST_GVG_performance_governing_trails_block
|
||||
where ods_record=1
|
||||
and (c32 is not null and c33 is not null and c34 is not null and c35 is not null and c36 is not null);
|
||||
|
||||
end
|
||||
$$ LANGUAGE plpgsql;
|
||||
Reference in New Issue
Block a user