forked from meldig/SQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajout des éléments nécessaires à la gestion des URLs des dossiers
Ajout des requêtes pour créer la table: - ta_gg_repertoire corriger la table - ta_gg_url_file ajouter les libelles longs et la famille propre aux urls dans les tables du schéma G_GEO
- Loading branch information
1 parent
ed17bf7
commit 9aebc2c
Showing
3 changed files
with
146 additions
and
5 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
integration/G_GESTIONGEO/remplissage_tables_finales/remplissage_tables_g_geo.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
Instructions DML pour intégrer en base les libelles | ||
*/ | ||
|
||
-- 1. AJOUT DE LA FAMILLE URL | ||
MERGE INTO G_GEO.TA_FAMILLE a | ||
USING | ||
( | ||
SELECT | ||
'URL' AS VALEUR | ||
FROM | ||
DUAL | ||
)b | ||
ON(a.valeur = b.valeur) | ||
WHEN NOT MATCHED THEN | ||
INSERT (a.valeur) | ||
VALUES (b.valeur) | ||
; | ||
COMMIT; | ||
|
||
|
||
-- 2. AJOUT DES URLS DANS LA TABLE TA_LIBELLE_LONG | ||
MERGE INTO G_GEO.TA_LIBELLE_LONG a | ||
USING | ||
( | ||
SELECT | ||
'/var/www/extraction/apps/gestiongeo' AS VALEUR | ||
FROM | ||
DUAL | ||
UNION | ||
SELECT | ||
'https://gtf.lillemetropole.fr/apps/gestiongeo/' AS VALEUR | ||
FROM | ||
DUAL | ||
)b | ||
ON(a.valeur = b.valeur) | ||
WHEN NOT MATCHED THEN | ||
INSERT (a.valeur) | ||
VALUES (b.valeur) | ||
; | ||
COMMIT; | ||
|
||
|
||
-- 3. Ajout des relations libelles/famille | ||
MERGE INTO G_GEO.TA_FAMILLE_LIBELLE a | ||
USING | ||
( | ||
SELECT | ||
a.objectid AS FID_FAMILLE, | ||
b.objectid AS FID_LIBELLE_LONG | ||
FROM | ||
G_GEO.TA_FAMILLE a, | ||
G_GEO.TA_LIBELLE_LONG b | ||
WHERE | ||
UPPER(a.valeur) = UPPER('URL') | ||
AND UPPER(b.valeur) IN (UPPER('/var/www/extraction/apps/gestiongeo'),UPPER('https://gtf.lillemetropole.fr/apps/gestiongeo/')) | ||
)b | ||
ON(a.fid_libelle_long = b.fid_libelle_long) | ||
WHEN NOT MATCHED THEN | ||
INSERT (a.fid_libelle_long) | ||
VALUES (b.fid_libelle_long) | ||
; | ||
COMMIT; | ||
|
||
|
||
-- 4. AJOUT DES CLES ETRANGERES DANS LA TABLE TA_LIBELLE | ||
MERGE INTO G_GEO.TA_LIBELLE a | ||
USING | ||
( | ||
SELECT | ||
a.OBJECTID AS FID_LIBELLE_LONG | ||
FROM | ||
G_GEO.TA_LIBELLE_LONG a | ||
WHERE | ||
UPPER(a.valeur) IN (UPPER('/var/www/extraction/apps/gestiongeo'),UPPER('https://gtf.lillemetropole.fr/apps/gestiongeo/')) | ||
)b | ||
ON(a.fid_libelle_long = b.fid_libelle_long) | ||
WHEN NOT MATCHED THEN | ||
INSERT (a.fid_libelle_long) | ||
VALUES (b.fid_libelle_long) | ||
; | ||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
TA_GG_REPERTOIRE : Table qui présente les chemins d''accès aux fichiers des dossiers gestiongeo.. | ||
*/ | ||
|
||
-- 1. Création de la table TA_GG_REPERTOIRE | ||
CREATE TABLE G_GESTIONGEO.TA_GG_REPERTOIRE ( | ||
OBJECTID NUMBER(38,0) GENERATED BY DEFAULT AS IDENTITY START WITH 1 INCREMENT BY 1, | ||
REPERTOIRE VARCHAR2(4000 BYTE) NOT NULL, | ||
FID_LIBELLE NUMBER(38,0) NOT NULL | ||
); | ||
|
||
|
||
-- 2. Les commentaires | ||
COMMENT ON TABLE G_GESTIONGEO.TA_GG_REPERTOIRE IS 'Table qui présente les chemins d''accès aux fichiers des dossiers gestiongeo.'; | ||
COMMENT ON COLUMN G_GESTIONGEO.TA_GG_REPERTOIRE.OBJECTID IS 'Clé primaire de la table.'; | ||
COMMENT ON COLUMN G_GESTIONGEO.TA_GG_REPERTOIRE.REPERTOIRE IS 'Chemin des repertoire.'; | ||
COMMENT ON COLUMN G_GESTIONGEO.TA_GG_REPERTOIRE.FID_LIBELLE IS 'Clé étrangère vers la table G_GEO.TA_LIBELLE pour caractériser le chemin.'; | ||
|
||
|
||
-- 3. Les contraintes | ||
-- 3.1. Contrainte de clé primaire | ||
ALTER TABLE G_GESTIONGEO.TA_GG_REPERTOIRE | ||
ADD CONSTRAINT TA_GG_REPERTOIRE_PK | ||
PRIMARY KEY("OBJECTID") | ||
USING INDEX TABLESPACE G_ADT_INDX; | ||
|
||
-- 3.2. Contrainte de clé étrangère | ||
ALTER TABLE G_GESTIONGEO.TA_GG_REPERTOIRE | ||
ADD CONSTRAINT TA_GG_REPERTOIRE_FID_LIBELLE_FK | ||
FOREIGN KEY("FID_LIBELLE") | ||
REFERENCES G_GEO.TA_LIBELLE ("OBJECTID"); | ||
|
||
|
||
-- 4. Les indexes | ||
CREATE INDEX G_GESTIONGEO."TA_GG_REPERTOIRE_REPERTOIRE_IDX" ON G_GESTIONGEO.TA_GG_REPERTOIRE ("REPERTOIRE") | ||
TABLESPACE G_ADT_INDX; | ||
|
||
|
||
-- 5. Les droits de lecture, écriture, suppression | ||
GRANT SELECT ON G_GESTIONGEO.TA_GG_REPERTOIRE TO G_ADMIN_SIG; | ||
GRANT SELECT ON G_GESTIONGEO.TA_GG_REPERTOIRE TO G_GESTIONGEO_R; | ||
GRANT SELECT, INSERT, UPDATE, DELETE ON G_GESTIONGEO.TA_GG_REPERTOIRE TO G_GESTIONGEO_RW; | ||
|
||
/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters