@ -41,6 +41,7 @@ null::char(10) as hrst,
@@ -41,6 +41,7 @@ null::char(10) as hrst,
null : : integer as fachsemester ,
null : : integer as hssem ,
( case when SG . studiengangs_typ_kb in ( ' TSG ' ) then SA . studienstatustyp else null : : char ( 10 ) end ) as statustyp_tsg ,
( case when ST . hauptstudium_flag = ' J ' then 1 : : smallint else 0 : : smallint end ) as primaerflag_studien ,
0 : : smallint as tsg_generated ,
- - 0 : : smallint as primaerflag ,
null : : integer as studiengang_nr ,
@ -51,7 +52,12 @@ null::date as ruebeudat,
@@ -51,7 +52,12 @@ null::date as ruebeudat,
null : : date as endedat ,
null : : smallint as kz_rueck_beur_ein ,
null : : smallint as kz_rueck_beur_ein_tsg ,
null : : char ( 10 ) as hzb_art ,
null : : integer as hzb_art_nr ,
null : : integer as hzb_land_nr ,
null : : integer as hzb_land_sub_r_nr ,
null : : integer as hzb_jahr ,
null : : date as hzb_datum ,
null : : decimal ( 14 , 7 ) as hzb_note ,
rank ( ) over ( partition by SM . st_sem_nr , S . st_studstamm_nr , SG . studiengangs_identifikator order by SA . gueltig_ab desc ) as status_historie
into temp tmp_studien
FROM costage_st_studierendenstammdaten S ,
@ -97,37 +103,58 @@ and F.fachsemestertyp='FS'
@@ -97,37 +103,58 @@ and F.fachsemestertyp='FS'
update tmp_studien
set hzb_art = H . hzb_art_stla_code
from costage_bw_bewerb_hzb H , costage_bw_bewerbungen BW
where tmp_studien . st_studstamm_nr = BW . st_studstamm_nr
and BW . nr = H . bw_bewrbng_nr
set hzb_art_nr = H . hzb_art_nr ,
hzb_datum = H . hzb_datum ,
hzb_note = ( case when substring ( H . hzb_note from 1 for 1 ) ~ ' [0-9] '
and substring ( H . hzb_note from 2 for 1 ) in ( ' , ' , ' . ' )
and substring ( H . hzb_note from 3 for 1 ) ~ ' [0-9] '
and ( substring ( H . hzb_note from 4 for 1 ) ~ ' [0-9] ' or substring ( H . hzb_note from 4 for 1 ) = ' ' )
and length ( H . hzb_note ) < = 4 then to_number ( replace ( H . hzb_note , ' , ' , ' . ' ) , ' 9.99 ' ) else null : : decimal ( 8 , 4 ) end ) ,
hzb_land_sub_r_nr = H . hzb_land_sub_r_nr ,
hzb_land_nr = H . hzb_land_nr ,
hzb_jahr = H . hzb_jahr
from costage_st_hzb H
where tmp_studien . st_studstamm_nr = H . st_person_nr
;
create index tmp_ix1 on tmp_studien ( st_studiengang_nr ) ;
create index tmp_ix2 on tmp_studien ( st_studstamm_nr ) ;
create index tmp_ix3 on tmp_studien ( studiengangs_typ_kb ) ;
create index tmp_ix4 on tmp_studien ( st_sem_nr ) ;
create index tmp_ix5 on tmp_studien ( status_historie ) ;
select T . * , 1 : : smallint as primaerflag
- - Primärflag ermitteln :
- - 1 . Prio : aus px_st_studien_v :
select T . * , 1 : : integer as primaerflag
into temp tmp_studien2
from tmp_studien T
where T . status_historie = 1
and T . studiengangs_typ_kb in ( ' ESG ' , ' TSG ' )
and T . primaerflag_studien = 1
;
- - 2 . Prio : aus costage_st_hauptstudien :
insert into tmp_studien2
select T . * , 1 : : integer as primaerflag
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
and T . studiengangs_typ_kb in ( ' ESG ' , ' TSG ' )
and T . primaerflag_studien = 0
;
- - Studiengänge ohne Primärflag :
insert into tmp_studien2
select T . * , 0 : : small int as primaerflag
from tmp_studien T left outer join costage_st_hauptstudien H
on ( H . st_studstamm_nr = T . st_studstamm_nr
insert into tmp_studien2
select T . * , 0 : : integer 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 T . studiengangs_typ_kb in ( ' ESG ' , ' TSG ' )
and T . primaerflag_studien = 0
and H . st_studstamm_nr is null
;
@ -285,7 +312,11 @@ hssem,
@@ -285,7 +312,11 @@ hssem,
statustyp_tsg ,
tsg_generated ,
primaerflag ,
hzb_art ,
hzb_art_nr ,
hzb_land_sub_r_nr ,
hzb_jahr ,
hzb_datum ,
hzb_note ,
fachsemester )
select M . semester ,
@ -317,7 +348,11 @@ S.hssem,
@@ -317,7 +348,11 @@ S.hssem,
null : : char ( 10 ) as statustyp_tsg ,
1 as tsg_generated ,
0 as primaerflag , - - geschlossene TSG können kein Primärflag haben
S . hzb_art ,
S . hzb_art_nr ,
S . hzb_land_sub_r_nr ,
S . hzb_jahr ,
S . hzb_datum ,
S . hzb_note ,
max ( S . fachsemester )
from tmp_studien_msg_tsg_fehlend M , tmp_studien3 S - - , costage_st_semester E
where M . st_studiengang_nr_msg = S . st_studiengang_nr_msg_possible
@ -329,7 +364,7 @@ and M.semester != S.semester
@@ -329,7 +364,7 @@ and M.semester != S.semester
- - and S . st_studiengang_nr_msg = 34454
- - and S . studiengangs_bezeichnung = ' Bildungswissenschaften '
- - and M . semester = 20211
group by 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 23 , 24 , 25 , 26
group by 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30
;
- - statustyp und hrst nachladen :
@ -434,7 +469,7 @@ into temp tmp_studien3
@@ -434,7 +469,7 @@ into temp tmp_studien3
from tmp_studien2 T left outer join costage_st_studien_spoversionen SPO
on ( SPO . st_studium_nr = T . st_studium_nr
and SPO . gueltig_ab < T . semester_ende )
group by 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42
group by 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48
;
update tmp_studien3 set po_stp_stp_version_kb = SPO . po_stp_stp_version_kb
@ -481,7 +516,12 @@ st_studium_nr,
@@ -481,7 +516,12 @@ st_studium_nr,
stufrm ,
kz_rueck_beur_ein ,
kz_rueck_beur_ein_tsg ,
hzb_art ,
hzb_land_nr ,
hzb_land_sub_r_nr ,
hzb_art_nr ,
hzb_jahr ,
hzb_datum ,
hzb_note ,
po_stp_stp_version_kb ,
summe
)
@ -521,7 +561,12 @@ select st_studium_nr,
@@ -521,7 +561,12 @@ select st_studium_nr,
studienform_statistik_code as stufrm ,
kz_rueck_beur_ein ,
kz_rueck_beur_ein_tsg ,
hzb_art ,
hzb_land_nr ,
hzb_land_sub_r_nr ,
hzb_art_nr ,
hzb_jahr ,
hzb_datum ,
hzb_note ,
po_stp_stp_version_kb ,
1 as summe
from tmp_studien3
@ -554,7 +599,12 @@ st_studium_nr,
@@ -554,7 +599,12 @@ st_studium_nr,
stufrm ,
kz_rueck_beur_ein ,
kz_rueck_beur_ein_tsg ,
hzb_art ,
hzb_land_nr ,
hzb_land_sub_r_nr ,
hzb_art_nr ,
hzb_jahr ,
hzb_datum ,
hzb_note ,
po_stp_stp_version_kb ,
summe
)
@ -595,7 +645,12 @@ cast (NULL as int) as studiengang_nr2,
@@ -595,7 +645,12 @@ cast (NULL as int) as studiengang_nr2,
studienform_statistik_code as stufrm ,
kz_rueck_beur_ein ,
kz_rueck_beur_ein_tsg ,
hzb_art ,
hzb_land_nr ,
hzb_land_sub_r_nr ,
hzb_art_nr ,
hzb_jahr ,
hzb_datum ,
hzb_note ,
po_stp_stp_version_kb ,
1 as summe
from tmp_studien3
@ -605,16 +660,6 @@ cast (NULL as int) as studiengang_nr2,
@@ -605,16 +660,6 @@ cast (NULL as int) as studiengang_nr2,
;
- - HZB Data :
update costage_st_studien_aggr set hzb_art = H . hzb_art_stla_code ,
hzb_datum = H . zeugnisdatum ,
hzb_note = H . hzb_note ,
hzb_ort = H . land_sub_r_nr ,
hzb_staat = H . land_nr
from costage_bw_bewerb_hzb H , costage_bw_bewerbungen BW
where BW . nr = H . bw_bewrbng_nr
and costage_st_studien_aggr . st_studstamm_nr = BW . st_studstamm_nr
and costage_st_studien_aggr . semester > = $ { beginn_semester }
;
- - Abmeldungsart :
- - zuerst personbezogen :