|
|
@ -30,7 +30,7 @@ null::char(10) as hrst, |
|
|
|
null::integer as fachsemester, |
|
|
|
null::integer as fachsemester, |
|
|
|
null::integer as hssem, |
|
|
|
null::integer as hssem, |
|
|
|
null::char(10) as statustyp, |
|
|
|
null::char(10) as statustyp, |
|
|
|
0::smallint as primaerflag, |
|
|
|
--0::smallint as primaerflag, |
|
|
|
null::integer as studiengang_nr, |
|
|
|
null::integer as studiengang_nr, |
|
|
|
null::integer as fach_nr, |
|
|
|
null::integer as fach_nr, |
|
|
|
null::char(10) as unikey, |
|
|
|
null::char(10) as unikey, |
|
|
@ -91,35 +91,79 @@ and F.st_sem_nr=tmp_studien.st_sem_nr |
|
|
|
and F.fachsemestertyp='HS' |
|
|
|
and F.fachsemestertyp='HS' |
|
|
|
; |
|
|
|
; |
|
|
|
--todo: langsam: |
|
|
|
--todo: langsam: |
|
|
|
update tmp_studien |
|
|
|
-- update tmp_studien |
|
|
|
set primaerflag=1 |
|
|
|
-- set primaerflag=1 |
|
|
|
where exists (select st_studstamm_nr |
|
|
|
-- where exists (select st_studstamm_nr |
|
|
|
from costage_st_hauptstudien H |
|
|
|
-- from costage_st_hauptstudien H |
|
|
|
where H.st_studstamm_nr=tmp_studien.st_studstamm_nr |
|
|
|
-- where H.st_studstamm_nr=tmp_studien.st_studstamm_nr |
|
|
|
and H.st_studium_nr=tmp_studien.st_studium_nr |
|
|
|
-- and H.st_studium_nr=tmp_studien.st_studium_nr |
|
|
|
and H.st_sem_nr=tmp_studien.st_sem_nr); |
|
|
|
-- and H.st_sem_nr=tmp_studien.st_sem_nr); |
|
|
|
|
|
|
|
select T.*,1::smallint as primaerflag |
|
|
|
|
|
|
|
into temp tmp_studien2 |
|
|
|
|
|
|
|
from tmp_studien T, costage_st_hauptstudien H |
|
|
|
|
|
|
|
where H.st_studstamm_nr=T.st_studstamm_nr |
|
|
|
|
|
|
|
and H.st_studium_nr=T.st_studium_nr |
|
|
|
|
|
|
|
and H.st_sem_nr=T.st_sem_nr |
|
|
|
|
|
|
|
and status_historie=1 |
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
--Studiengänge ohne Primärflag: |
|
|
|
|
|
|
|
insert into tmp_studien2 |
|
|
|
|
|
|
|
select T.*,0::smallint as primaerflag |
|
|
|
|
|
|
|
from tmp_studien T left outer join costage_st_hauptstudien H |
|
|
|
|
|
|
|
on (H.st_studstamm_nr=T.st_studstamm_nr |
|
|
|
|
|
|
|
and H.st_studium_nr=T.st_studium_nr |
|
|
|
|
|
|
|
and H.st_sem_nr=T.st_sem_nr) |
|
|
|
|
|
|
|
where T.status_historie=1 |
|
|
|
|
|
|
|
and H.st_studstamm_nr is null |
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drop table tmp_studien; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--Ermittlung msg: |
|
|
|
|
|
|
|
update tmp_studien2 set st_studiengang_nr_msg=M.st_studiengang_nr_msg |
|
|
|
|
|
|
|
from costage_st_studiengaenge_mtsg M, costage_st_studien ST |
|
|
|
|
|
|
|
where ST.st_studiengang_nr=M.st_studiengang_nr_msg |
|
|
|
|
|
|
|
and ST.st_studstamm_nr=tmp_studien2.st_studstamm_nr |
|
|
|
|
|
|
|
and M.st_studiengang_nr_tsg=tmp_studien2.st_studiengang_nr |
|
|
|
|
|
|
|
and tmp_studien2.studiengangs_typ_kb ='TSG' |
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
update tmp_studien set fach_nr=M.studienfach_sortierung |
|
|
|
--Ermittlung fach_nr: |
|
|
|
|
|
|
|
update tmp_studien2 set fach_nr=M.studienfach_sortierung |
|
|
|
from costage_st_studiengaenge_mtsg M |
|
|
|
from costage_st_studiengaenge_mtsg M |
|
|
|
where M.st_studiengang_nr_tsg=tmp_studien.st_studiengang_nr |
|
|
|
where M.st_studiengang_nr_msg=tmp_studien2.st_studiengang_nr_msg |
|
|
|
|
|
|
|
and M.st_studiengang_nr_tsg=tmp_studien2.st_studiengang_nr |
|
|
|
|
|
|
|
and tmp_studien2.studiengangs_typ_kb ='TSG' |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
update tmp_studien set fach_nr=1 |
|
|
|
update tmp_studien2 set fach_nr=1 |
|
|
|
where fach_nr is null; |
|
|
|
where fach_nr is null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--Ermittlung status bei TSG aus MSG: |
|
|
|
|
|
|
|
update tmp_studien2 set studienstatustyp=SA.studienstatustyp |
|
|
|
|
|
|
|
from costage_st_studienstatus SA, costage_st_studiengaenge SG ,costage_st_studien ST |
|
|
|
|
|
|
|
where SG.st_studiengang_nr=tmp_studien2.st_studiengang_nr_msg |
|
|
|
|
|
|
|
and ST.st_studium_nr=SA.st_studium_nr |
|
|
|
|
|
|
|
and ST.st_studstamm_nr=tmp_studien2.st_studstamm_nr |
|
|
|
|
|
|
|
and SA.st_sem_nr=tmp_studien2.st_sem_nr |
|
|
|
|
|
|
|
and tmp_studien2.studiengangs_typ_kb ='TSG' |
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update tmp_studien set unikey=val(K.unikey) |
|
|
|
update tmp_studien2 set unikey=K.unikey |
|
|
|
from costage_st_studiengaenge G, costage_st_studienkennzahlen K |
|
|
|
from costage_st_studiengaenge G, costage_st_studienkennzahlen K |
|
|
|
where G.st_studiengang_nr=tmp_studien.st_studiengang_nr |
|
|
|
where G.st_studiengang_nr=tmp_studien2.st_studiengang_nr |
|
|
|
and K.st_skz_nr=G.st_skz_nr |
|
|
|
and K.st_skz_nr=G.st_skz_nr |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
update tmp_studien set kz_rueck_beur_ein=(select val(astat) |
|
|
|
update tmp_studien2 set kz_rueck_beur_ein=(select val(astat) |
|
|
|
from cifx where key=400 |
|
|
|
from cifx where key=400 |
|
|
|
and apnr=tmp_studien.studienstatustyp |
|
|
|
and apnr=tmp_studien2.studienstatustyp |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
--wenn die Exmatrikulation zum Semesterende stattfand, wird Status auf Rückgemeldet gesetzt: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delete from costage_st_studien_aggr; |
|
|
|
delete from costage_st_studien_aggr; |
|
|
@ -156,7 +200,9 @@ select st_studium_nr, |
|
|
|
fachsemester, |
|
|
|
fachsemester, |
|
|
|
hssem, |
|
|
|
hssem, |
|
|
|
primaerflag, |
|
|
|
primaerflag, |
|
|
|
rank () over (partition by semester, st_studstamm_nr order by primaerflag desc,st_studium_nr asc) |
|
|
|
rank () over (partition by semester, st_studstamm_nr order by primaerflag desc, |
|
|
|
|
|
|
|
(case when studiengangs_typ_kb='TSG' then st_absz_nr else st_studium_nr end ) |
|
|
|
|
|
|
|
) |
|
|
|
as studiengang_nr, |
|
|
|
as studiengang_nr, |
|
|
|
fach_nr, |
|
|
|
fach_nr, |
|
|
|
unikey, |
|
|
|
unikey, |
|
|
@ -167,10 +213,10 @@ select st_studium_nr, |
|
|
|
else null::date end) as endedat, |
|
|
|
else null::date end) as endedat, |
|
|
|
studienform_statistik_code as stufrm, |
|
|
|
studienform_statistik_code as stufrm, |
|
|
|
kz_rueck_beur_ein |
|
|
|
kz_rueck_beur_ein |
|
|
|
from tmp_studien |
|
|
|
from tmp_studien2 |
|
|
|
where status_historie=1; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drop table tmp_studien; |
|
|
|
drop table tmp_studien2; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|