can someone help me checking the codes on following script can tell me if there is any better way to make a report on it.
plz its very imp if some can help me thanks/* STAFFING GOALS */
/* ASR NUMBERS */
select mos,
sum(e9_o7_w5) e9, sum(e8_o6_w4) e8, sum(e7_o5_w3) e7,
sum(e6_o4_w2) e6, sum(e5_o3_w1) e5, sum(e4_o2o1) e4, sum(e3_wo) e3,
sum(e2e1) e2e1,
sum(e9_o7_w5) + sum(e8_o6_w4) + sum(e7_o5_w3) +
sum(e6_o4_w2) + sum(e5_o3_w1) + sum(e4_o2o1) + sum(e3_wo) + sum(e2e1) total
from tfdw_mlp.pmcc_asr
where run_id = '0800y01 ' and tmr_type_code='E'
group by mos
/* STAFFING GOALS */
SELECT a.dutytype, b.PMOS,
sum(DECODE(b.GRADE,9,1,0))E9, sum(DECODE(b.GRADE,8,1,0))E8,
sum(DECODE(b.GRADE,7,1,0))E7, sum(DECODE(b.GRADE,6,1,0))E6,
sum(DECODE(b.GRADE,5,1,0))E5, sum(DECODE(b.GRADE,4,1,0))E4,
sum(DECODE(b.GRADE,3,1,0))E3, sum(DECODE(b.GRADE,2,1,0))E2,
sum(DECODE(b.GRADE,7,1,0)) + sum(DECODE(b.GRADE,6,1,0)) +
sum(DECODE(b.GRADE,5,1,0)) + sum(DECODE(b.GRADE,4,1,0)) +
sum(DECODE(b.GRADE,3,1,0)) + sum(DECODE(b.GRADE,2,1,0)) total
FROM ESGM.demand a,
esgm.supply b
WHERE a.run_id = b.run_id
and a.mos = b.pmos
and a.grade = b.grade
and a.demand_id = b.demand_id
and b.RUN_ID = 'octmodel' AND
(b.DEMAND_ID > 0 OR b.PASS2_DEMAND_ID > 0)
GROUP BY dutytype, PMOS
ORDER BY PMOS
/* T/O STRUCTURE */
select bmos, sum(e9) e9, sum(e8) e8, sum(e7) e7, sum(e6) e6, sum(e5) e5, sum(e4) e4,
sum(e3) e3, sum(e1_e2) e1_e2,
sum(e9)+sum(e8)+sum(e7)+sum(e6)+sum(e5)+sum(e4)+sum(e3)+sum(e1_e2) total
from
(select bmos,
decode(substr(pay_grade,1,2),'E9',
sum(billet_multiple*section_multiple*sub_section_multiple),0) E9,
decode(substr(pay_grade,1,2),'E8',
sum(billet_multiple*section_multiple*sub_section_multiple),0) E8,
decode(substr(pay_grade,1,2),'E7',
sum(billet_multiple*section_multiple*sub_section_multiple),0) E7,
decode(substr(pay_grade,1,2),'E6',
sum(billet_multiple*section_multiple*sub_section_multiple),0) E6,
decode(substr(pay_grade,1,2),'E5',
sum(billet_multiple*section_multiple*sub_section_multiple),0) E5,
decode(substr(pay_grade,1,2),'E4',
sum(billet_multiple*section_multiple*sub_section_multiple),0) E4,
decode(substr(pay_grade,1,2),'E3',
sum(billet_multiple*section_multiple*sub_section_multiple),0) E3,
decode(substr(pay_grade,1,2),'E2',
sum(billet_multiple*section_multiple*sub_section_multiple),0) +
decode(substr(pay_grade,1,2),'E1',
sum(billet_multiple*section_multiple*sub_section_multiple),0) E1_E2,
decode((sign(sum(billet_multiple*section_multiple*sub_section_multiple)-1)),
1,' ',-1,' ',' ') total
from wasr.tmr_extract
where branch != 'R'
and effective_date=to_date('01-oct-2000','dd-mon-yyyy')
and pay_grade not like 'O%'
group by bmos, pay_grade)
group by bmos
/* NON PRIMARY MOS ALLOCATION */
select amos,
sum(e9) e9, sum(e8) e8 , sum(e7) e7, sum(e6) e6 , sum(e5) e5 ,
sum(e4) e4, sum(e3) e3,
sum(e9) + sum(e8) + sum(e7)+ sum(e6) + sum(e5) + sum(e4) + sum(e3) total
from
((select amos,
sum(amount) E9,
decode(substr(grade,1,2),'E8',1,0) E8,
decode(substr(grade,1,2),'E7',1,0) E7,
decode(substr(grade,1,2),'E6',1,0) E6,
decode(substr(grade,1,2),'E5',1,0) E5,
decode(substr(grade,1,2),'E4',1,0) E4,
decode(substr(grade,1,2),'E3',1,0) E3
from bbilletspread where
runid='fy01enlm' and grade='E9'
group by amos, grade)
union
(select amos,
decode(substr(grade,1,2),'E9',1,0) E9,
sum(amount) E8,
decode(substr(grade,1,2),'E7',1,0) E7,
decode(substr(grade,1,2),'E6',1,0) E6,
decode(substr(grade,1,2),'E5',1,0) E5,
decode(substr(grade,1,2),'E4',1,0) E4,
decode(substr(grade,1,2),'E3',1,0) E3
from bbilletspread where
runid='fy01enlm' and grade='E8'
group by amos, grade)
union
(select amos,
decode(substr(grade,1,2),'E9',1,0) E9,
decode(substr(grade,1,2),'E8',1,0) E8,
sum(amount) E7,
decode(substr(grade,1,2),'E6',1,0) E6,
decode(substr(grade,1,2),'E5',1,0) E5,
decode(substr(grade,1,2),'E4',1,0) E4,
decode(substr(grade,1,2),'E3',1,0) E3
from bbilletspread where
runid='fy01enlm' and grade='E7'
group by amos, grade)
union
(select amos,
decode(substr(grade,1,2),'E9',1,0) E9,
decode(substr(grade,1,2),'E8',1,0) E8,
decode(substr(grade,1,2),'E7',1,0) E7,
sum(amount) E6,
decode(substr(grade,1,2),'E5',1,0) E5,
decode(substr(grade,1,2),'E4',1,0) E4,
decode(substr(grade,1,2),'E3',1,0) E3
from bbilletspread where
runid='fy01enlm' and grade='E6'
group by amos, grade)
union
(select amos,
decode(substr(grade,1,2),'E9',1,0) E9,
decode(substr(grade,1,2),'E8',1,0) E8,
decode(substr(grade,1,2),'E7',1,0) E7,
decode(substr(grade,1,2),'E6',1,0) E6,
sum(amount) E5,
decode(substr(grade,1,2),'E4',1,0) E4,
decode(substr(grade,1,2),'E3',1,0) E3
from bbilletspread where
runid='fy01enlm' and grade='E5'
group by amos, grade)
union
(select amos,
decode(substr(grade,1,2),'E9',1,0) E9,
decode(substr(grade,1,2),'E8',1,0) E8,
decode(substr(grade,1,2),'E7',1,0) E7,
decode(substr(grade,1,2),'E6',1,0) E6,
decode(substr(grade,1,2),'E5',1,0) E5,
sum(amount) E4,
decode(substr(grade,1,2),'E3',1,0) E3
from bbilletspread where
runid='fy01enlm' and grade='E4'
group by amos, grade)
union
(select amos,
decode(substr(grade,1,2),'E9',1,0) E9,
decode(substr(grade,1,2),'E8',1,0) E8,
decode(substr(grade,1,2),'E7',1,0) E7,
decode(substr(grade,1,2),'E6',1,0) E6,
decode(substr(grade,1,2),'E5',1,0) E5,
decode(substr(grade,1,2),'E4',1,0) E4,
sum(amount) E3
from bbilletspread where
runid='fy01enlm' and grade='E3'
group by amos, grade))
group by amos
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks