Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
open-source
OSE
Commits
ea014e13
Commit
ea014e13
authored
Oct 04, 2021
by
Antony Le Courtes
Browse files
Adaptation MV_INTERVENANT.sql et statut autre...
parent
0a6e15d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
doc/Connecteurs-Import/Octopus/MV_INTERVENANT.sql
View file @
ea014e13
CREATE
MATERIALIZED
VIEW
MV_INTERVENANT
AS
WITH
i
AS
(
WITH
i
AS
(
SELECT
DISTINCT
code
,
MAX
(
z_statut_id
)
OVER
(
partition
by
code
,
z_statut_id
)
z_statut_id
,
...
...
@@ -22,14 +22,16 @@ WITH i AS (
ELSE
'vacataire'
END
z_type
,
icto
.
id_orig
source_code
,
COALESCE
(
icto
.
d_debut
,
to_date
(
'01/01/1900'
,
'dd/mm/YYYY'
))
validite_debut
,
COALESCE
(
icto
.
d_fin
,
to_date
(
'01/01/9999'
,
'dd/mm/YYYY'
))
validite_fin
,
CASE
WHEN
icto
.
d_fin
=
to_date
(
'01/09/2021'
,
'dd/mm/YYYY'
)
THEN
to_date
(
'31/08/2021'
,
'dd/mm/YYYY'
)
ELSE
COALESCE
(
icto
.
d_fin
,
to_date
(
'01/01/9999'
,
'dd/mm/YYYY'
))
END
validite_fin
,
NULL
fin_affectation_siham
FROM
octo
.
v_individu_contrat_type_ose
@
octoprod
icto
JOIN
octo
.
individu_unique
@
octoprod
uni
ON
icto
.
individu_id
=
uni
.
c_individu_chaine
JOIN
octo
.
v_individu_statut
@
octoprod
vinds
ON
vinds
.
individu_id
=
uni
.
c_individu_chaine
WHERE
icto
.
d_debut
-
184
<=
SYSDATE
AND
icto
.
code_ose
IS
NOT
NULL
WHERE
icto
.
d_debut
-
184
<=
SYSDATE
AND
icto
.
code_ose
IS
NOT
NULL
UNION
ALL
-- Step 2 : on prend tout le reste potentiel vacataire, notamment les hébergés
...
...
@@ -40,7 +42,9 @@ WITH i AS (
ELSE
'vacataire'
END
z_type
,
uni
.
c_individu_chaine
||
'-autre'
source_code
,
COALESCE
(
inds
.
d_debut
,
to_date
(
'01/01/1900'
,
'dd/mm/YYYY'
))
validite_debut
,
COALESCE
(
inds
.
d_fin
,
to_date
(
'01/01/9999'
,
'dd/mm/YYYY'
))
validite_fin
,
CASE
WHEN
inds
.
d_fin
=
to_date
(
'01/09/2021'
,
'dd/mm/YYYY'
)
THEN
to_date
(
'31/08/2021'
,
'dd/mm/YYYY'
)
ELSE
COALESCE
(
inds
.
d_fin
,
to_date
(
'01/01/9999'
,
'dd/mm/YYYY'
))
END
validite_fin
,
CASE
WHEN
inds
.
c_source
=
'SIHAM'
THEN
inds
.
d_fin
ELSE
NULL
END
fin_affectation_siham
...
...
@@ -58,7 +62,7 @@ WITH i AS (
OR
(
inds
.
t_vacataire
=
'O'
)
OR
(
inds
.
t_heberge
=
'O'
))
AND
icto
.
individu_id
IS
NULL
AND
(
vinds
.
t_doctorant
=
'N'
OR
vinds
.
individu_id
IS
NULL
)
--
AND (vinds.t_doctorant='N' OR vinds.individu_id IS NULL)
AND
inds
.
c_source
IN
(
'HARP'
,
'OCTO'
,
'SIHAM'
)
)
t
),
...
...
@@ -277,6 +281,4 @@ FROM i
LEFT
JOIN
compte
ON
compte
.
individu_id
=
induni
.
c_individu_chaine
--On récupére la discipline adaptée directement dans Octopus
LEFT
JOIN
cnua
cnua
ON
cnua
.
individu_id
=
induni
.
c_individu_chaine
WHERE
i
.
validite_fin
>=
(
SYSDATE
-
(
365
*
2
))
WHERE
i
.
validite_fin
>=
(
SYSDATE
-
(
365
*
2
))
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment