Daniel Quathamer
11 months ago
3 changed files with 252 additions and 2 deletions
@ -0,0 +1,13 @@ |
|||||||
|
delete from hochschulinfo; |
||||||
|
insert into hochschulinfo(name, |
||||||
|
-- adresse, |
||||||
|
hs_nr, |
||||||
|
kapitel, |
||||||
|
superx_server |
||||||
|
-- kennung, |
||||||
|
-- passwd |
||||||
|
) |
||||||
|
select min(auspraegung_label_4),hs_nr,'','' |
||||||
|
from sxc_stud_sem_da_geschl_hs |
||||||
|
group by 2; |
||||||
|
|
@ -0,0 +1,235 @@ |
|||||||
|
-- Hier werden die Daten aus kenn_hochschulen in die Tabelle organigramm geladen |
||||||
|
-- nur für SuperX-Connect |
||||||
|
|
||||||
|
delete from organigramm; |
||||||
|
|
||||||
|
|
||||||
|
create temp table tmp_organigramm ( |
||||||
|
tid serial not null, |
||||||
|
key_apnr CHAR(10) , |
||||||
|
parent CHAR(10) , |
||||||
|
drucktext CHAR(50) , |
||||||
|
name NCHAR(150) , |
||||||
|
ebene INTEGER , |
||||||
|
lehre SMALLINT not null, |
||||||
|
gueltig_seit DATE not null, |
||||||
|
gueltig_bis DATE not null, |
||||||
|
orgstruktur INTEGER |
||||||
|
) |
||||||
|
; |
||||||
|
--root |
||||||
|
insert into tmp_organigramm |
||||||
|
(name,drucktext,key_apnr,parent,ebene,lehre,gueltig_seit,gueltig_bis,orgstruktur) |
||||||
|
SELECT 'Hochschulen', |
||||||
|
'Hochschulen', --drucktext |
||||||
|
'0',--key_apnr |
||||||
|
null::char(10), --parent |
||||||
|
1, --ebene |
||||||
|
1, --lehre |
||||||
|
date_val('01.01.1900'), |
||||||
|
date_val('31.12.2999'), |
||||||
|
0 --orgstruktur |
||||||
|
FROM xdummy; |
||||||
|
|
||||||
|
|
||||||
|
-- UNI (parent=1) |
||||||
|
|
||||||
|
insert into tmp_organigramm |
||||||
|
(name,drucktext,key_apnr,parent,ebene,lehre,gueltig_seit,gueltig_bis,orgstruktur) |
||||||
|
SELECT 'Universitäten', |
||||||
|
'Universitäten', --drucktext |
||||||
|
'1',--key_apnr |
||||||
|
'0'::char(10), --parent |
||||||
|
2, --ebene |
||||||
|
1, --lehre |
||||||
|
date_val('01.01.1900'), |
||||||
|
date_val('31.12.2999'), |
||||||
|
0 --orgstruktur |
||||||
|
FROM xdummy; |
||||||
|
|
||||||
|
|
||||||
|
insert into tmp_organigramm |
||||||
|
(name,drucktext,key_apnr,parent,ebene,lehre,gueltig_seit,gueltig_bis,orgstruktur) |
||||||
|
SELECT substring(name from 1 for 150), |
||||||
|
substring(name from 1 for 50), --drucktext |
||||||
|
trim(hs_nr::char(10)),--key_apnr |
||||||
|
'1'::char(10), --parent |
||||||
|
3, --ebene |
||||||
|
0, --lehre |
||||||
|
date_val('01.01.1900'), |
||||||
|
date_val('31.12.2999'), |
||||||
|
10 --orgstruktur |
||||||
|
FROM kenn_hochschulen where art='U' |
||||||
|
--nur Hochschulen, die auch als Org-Einheiten drin sind: |
||||||
|
and hs_nr in (select H.hs_nr from hochschulinfo H); |
||||||
|
; |
||||||
|
|
||||||
|
-- PH (parent=2) |
||||||
|
|
||||||
|
insert into tmp_organigramm |
||||||
|
(name,drucktext,key_apnr,parent,ebene,lehre,gueltig_seit,gueltig_bis,orgstruktur) |
||||||
|
SELECT 'Pädagogische Hochschulen', |
||||||
|
'Pädagogische Hochschulen', --drucktext |
||||||
|
'2',--key_apnr |
||||||
|
'0'::char(10), --parent |
||||||
|
2, --ebene |
||||||
|
1, --lehre |
||||||
|
date_val('01.01.1900'), |
||||||
|
date_val('31.12.2999'), |
||||||
|
0 --orgstruktur |
||||||
|
FROM xdummy; |
||||||
|
|
||||||
|
|
||||||
|
insert into tmp_organigramm |
||||||
|
(name,drucktext,key_apnr,parent,ebene,lehre,gueltig_seit,gueltig_bis,orgstruktur) |
||||||
|
SELECT substring(name from 1 for 150), |
||||||
|
substring(name from 1 for 50), --drucktext |
||||||
|
trim(hs_nr::char(10)),--key_apnr |
||||||
|
'2'::char(10), --parent |
||||||
|
3, --ebene |
||||||
|
0, --lehre |
||||||
|
date_val('01.01.1900'), |
||||||
|
date_val('31.12.2999'), |
||||||
|
10 --orgstruktur |
||||||
|
FROM kenn_hochschulen where art='PH' |
||||||
|
--nur Hochschulen, die auch als Org-Einheiten drin sind: |
||||||
|
and hs_nr in (select H.hs_nr from hochschulinfo H); |
||||||
|
; |
||||||
|
|
||||||
|
-- FH (parent=3) |
||||||
|
insert into tmp_organigramm |
||||||
|
(name,drucktext,key_apnr,parent,ebene,lehre,gueltig_seit,gueltig_bis,orgstruktur) |
||||||
|
SELECT 'Hochschulen für angewandte Wissenschaften', |
||||||
|
'Hochschulen für angewandte Wissenschaften', --drucktext |
||||||
|
'3',--key_apnr |
||||||
|
'0'::char(10), --parent |
||||||
|
2, --ebene |
||||||
|
1, --lehre |
||||||
|
date_val('01.01.1900'), |
||||||
|
date_val('31.12.2999'), |
||||||
|
0 --orgstruktur |
||||||
|
FROM xdummy; |
||||||
|
|
||||||
|
insert into tmp_organigramm |
||||||
|
(name,drucktext,key_apnr,parent,ebene,lehre,gueltig_seit,gueltig_bis,orgstruktur) |
||||||
|
SELECT substring(name from 1 for 150), |
||||||
|
substring(name from 1 for 50), --drucktext |
||||||
|
trim(hs_nr::char(10)),--key_apnr |
||||||
|
'3'::char(10), --parent |
||||||
|
3, --ebene |
||||||
|
0, --lehre |
||||||
|
date_val('01.01.1900'), |
||||||
|
date_val('31.12.2999'), |
||||||
|
10 --orgstruktur |
||||||
|
FROM kenn_hochschulen where art='FH' |
||||||
|
|
||||||
|
--nur Hochschulen, die auch als Org-Einheiten drin sind: |
||||||
|
and hs_nr in (select H.hs_nr from hochschulinfo H); |
||||||
|
; |
||||||
|
|
||||||
|
-- Kunst Musik (parent=4) |
||||||
|
|
||||||
|
insert into tmp_organigramm |
||||||
|
(name,drucktext,key_apnr,parent,ebene,lehre,gueltig_seit,gueltig_bis,orgstruktur) |
||||||
|
SELECT 'Kunst- und Musikhochschulen', |
||||||
|
'Kunst- und Musikhochschulen', --drucktext |
||||||
|
'4',--key_apnr |
||||||
|
'0'::char(10), --parent |
||||||
|
2, --ebene |
||||||
|
1, --lehre |
||||||
|
date_val('01.01.1900'), |
||||||
|
date_val('31.12.2999'), |
||||||
|
0 --orgstruktur |
||||||
|
FROM xdummy; |
||||||
|
|
||||||
|
|
||||||
|
insert into tmp_organigramm |
||||||
|
(name,drucktext,key_apnr,parent,ebene,lehre,gueltig_seit,gueltig_bis,orgstruktur) |
||||||
|
SELECT substring(name from 1 for 150), |
||||||
|
substring(name from 1 for 50), --drucktext |
||||||
|
trim(hs_nr::char(10)),--key_apnr |
||||||
|
'4'::char(10), --parent |
||||||
|
3, --ebene |
||||||
|
0, --lehre |
||||||
|
date_val('01.01.1900'), |
||||||
|
date_val('31.12.2999'), |
||||||
|
10 --orgstruktur |
||||||
|
FROM kenn_hochschulen where art='KMW' |
||||||
|
|
||||||
|
--nur Hochschulen, die auch als Org-Einheiten drin sind: |
||||||
|
and hs_nr in (select H.hs_nr from hochschulinfo H); |
||||||
|
; |
||||||
|
|
||||||
|
-- DH (parent=5) |
||||||
|
|
||||||
|
insert into tmp_organigramm |
||||||
|
(name,drucktext,key_apnr,parent,ebene,lehre,gueltig_seit,gueltig_bis,orgstruktur) |
||||||
|
SELECT 'Duale Hochschulen', |
||||||
|
'Duale Hochschulen', --drucktext |
||||||
|
'5',--key_apnr |
||||||
|
'0'::char(10), --parent |
||||||
|
2, --ebene |
||||||
|
1, --lehre |
||||||
|
date_val('01.01.1900'), |
||||||
|
date_val('31.12.2999'), |
||||||
|
0 --orgstruktur |
||||||
|
FROM xdummy; |
||||||
|
|
||||||
|
|
||||||
|
insert into tmp_organigramm |
||||||
|
(name,drucktext,key_apnr,parent,ebene,lehre,gueltig_seit,gueltig_bis,orgstruktur) |
||||||
|
SELECT substring(name from 1 for 150), |
||||||
|
substring(name from 1 for 50), --drucktext |
||||||
|
trim(hs_nr::char(10)),--key_apnr |
||||||
|
'5'::char(10), --parent |
||||||
|
3, --ebene |
||||||
|
0, --lehre |
||||||
|
date_val('01.01.1900'), |
||||||
|
date_val('31.12.2999'), |
||||||
|
10 --orgstruktur |
||||||
|
FROM kenn_hochschulen where art='DH' |
||||||
|
|
||||||
|
--nur Hochschulen, die auch als Org-Einheiten drin sind: |
||||||
|
and hs_nr in (select H.hs_nr from hochschulinfo H); |
||||||
|
; |
||||||
|
|
||||||
|
--BaWue-spez. Duplikate entfernen: |
||||||
|
|
||||||
|
delete from tmp_organigramm |
||||||
|
where key_apnr in ('1240','1820','1270','1250','8171','8172','8173','8174','8175','8176','8177','8178','8179'); |
||||||
|
|
||||||
|
|
||||||
|
--hochschulen bekommen orgstruktur 10, damit Sichten mit nodeattrib klappen: |
||||||
|
update organigramm set orgstruktur=10 |
||||||
|
where key_apnr in (select T.key_apnr |
||||||
|
from tmp_organigramm T |
||||||
|
where T.orgstruktur=10) |
||||||
|
; |
||||||
|
|
||||||
|
delete from organigramm |
||||||
|
where key_apnr in (select key_apnr from tmp_organigramm ) |
||||||
|
and 0=(select count(*) from tmp_organigramm T |
||||||
|
where organigramm.key_apnr || '_' || organigramm.name = T.key_apnr || '_' || T.name); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
delete from tmp_organigramm |
||||||
|
where key_apnr in (select key_apnr from organigramm); |
||||||
|
|
||||||
|
create temp table tmp_hilf (tid integer); |
||||||
|
insert into tmp_hilf select max(tid) from organigramm; |
||||||
|
|
||||||
|
update tmp_hilf set tid=1 where tid is null; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
insert into organigramm |
||||||
|
(tid,name,drucktext,key_apnr,parent,ebene,lehre,gueltig_seit,gueltig_bis,orgstruktur) |
||||||
|
SELECT O.tid+H.tid,name,drucktext,key_apnr,parent,ebene,lehre,gueltig_seit,gueltig_bis,orgstruktur |
||||||
|
FROM tmp_organigramm O, tmp_hilf H; |
||||||
|
|
||||||
|
|
||||||
|
drop table tmp_organigramm; |
||||||
|
drop table tmp_hilf; |
||||||
|
|
Loading…
Reference in new issue