You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

467 lines
21 KiB

select * from prod_shs.pigefi180_THP02ge where thcenr = 'CMV';
select * from prod_shs.pigefi180_arp01 limit 100;
TRUNCATE eco.t_gestionnaires;
INSERT INTO eco.t_gestionnaires(code, texte, texte_court, code_original)
SELECT GEKGEC, GENOMG, GENOMG, GEKGEC
FROM prod_shs.PIGEFI180_GEP01 LEFT JOIN eco.t_gestionnaires ON (code_original = GEKGEC)
WHERE code_original IS NULL;
INSERT INTO eco.t_gestionnaires(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseigné', 'Non renseigné'
WHERE 0 NOT IN (SELECT oid FROM eco.t_gestionnaires);
TRUNCATE eco.t_familles_articles;
INSERT INTO eco.t_familles_articles(code, texte, texte_court, code_original)
SELECT DISTINCT THCODE, MAX(THLI40), MAX(THLI40), THCODE
FROM prod_shs.PIGEFI180_THP02GE LEFT JOIN eco.t_familles_articles ON (code_original = THCODE)
WHERE THCENR = 'FS1' AND code_original IS NULL
GROUP BY 1;
INSERT INTO eco.t_familles_articles(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseignée', 'Non renseignée'
WHERE 0 NOT IN (SELECT oid FROM eco.t_familles_articles);
TRUNCATE eco.t_sous_familles_articles;
INSERT INTO eco.t_sous_familles_articles(code, texte, texte_court, code_original)
SELECT DISTINCT THCODE, MAX(THLI40), MAX(THLI40), THCODE
FROM prod_shs.PIGEFI180_THP02GE LEFT JOIN eco.t_sous_familles_articles ON (code_original = THCODE)
WHERE THCENR = 'FS2' AND code_original IS NULL
GROUP BY 1;
INSERT INTO eco.t_sous_familles_articles(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseignée', 'Non renseignée'
WHERE 0 NOT IN (SELECT oid FROM eco.t_sous_familles_articles);
TRUNCATE eco.t_types_articles;
INSERT INTO eco.t_types_articles(code, texte, texte_court, code_original)
SELECT DISTINCT THCODE, MAX(THLI40), MAX(THLI40), THCODE
FROM prod_shs.PIGEFI180_THP02GE LEFT JOIN eco.t_types_articles ON (code_original = THCODE)
WHERE THCENR = 'TAG' AND code_original IS NULL
GROUP BY 1;
INSERT INTO eco.t_types_articles(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseigné', 'Non renseigné'
WHERE 0 NOT IN (SELECT oid FROM eco.t_types_articles);
TRUNCATE eco.t_types_fournisseurs;
INSERT INTO eco.t_types_fournisseurs(code, texte, texte_court, code_original)
SELECT DISTINCT THCODE, MAX(THLI40), MAX(THLI40), THCODE
FROM prod_shs.PIGEFI180_THP02GE LEFT JOIN eco.t_types_fournisseurs ON (code_original = THCODE)
WHERE THCENR = 'TYF' AND code_original IS NULL
GROUP BY 1;
INSERT INTO eco.t_types_fournisseurs(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseigné', 'Non renseigné'
WHERE 0 NOT IN (SELECT oid FROM eco.t_types_fournisseurs);
TRUNCATE eco.t_categories_articles;
INSERT INTO eco.t_categories_articles(code, texte, texte_court, code_original)
SELECT DISTINCT THCODE, MAX(THLI40), MAX(THLI40), THCODE
FROM prod_shs.PIGEFI180_THP02GE LEFT JOIN eco.t_categories_articles ON (code_original = THCODE)
WHERE THCENR = 'CAT' AND code_original IS NULL
GROUP BY 1;
INSERT INTO eco.t_categories_articles(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseigné', 'Non renseigné'
WHERE 0 NOT IN (SELECT oid FROM eco.t_categories_articles);
TRUNCATE eco.t_sous_categories_articles;
INSERT INTO eco.t_sous_categories_articles(code, texte, texte_court, code_original)
SELECT DISTINCT THCODE, MAX(THLI40), MAX(THLI40), THCODE
FROM prod_shs.PIGEFI180_THP02GE LEFT JOIN eco.t_sous_categories_articles ON (code_original = THCODE)
WHERE THCENR = 'SCA' AND code_original IS NULL
GROUP BY 1;
INSERT INTO eco.t_sous_categories_articles(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseigné', 'Non renseigné'
WHERE 0 NOT IN (SELECT oid FROM eco.t_sous_categories_articles);
TRUNCATE eco.t_unites;
INSERT INTO eco.t_unites(code, texte, texte_court, code_original)
SELECT DISTINCT THCODE, MAX(THLI40), MAX(THLI40), THCODE
FROM prod_shs.PIGEFI180_THP02GE LEFT JOIN eco.t_unites ON (code_original = THCODE)
WHERE THCENR IN ( 'UDI', 'UST') AND code_original IS NULL
GROUP BY 1;
INSERT INTO eco.t_unites(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseignée', 'Non renseignée'
WHERE 0 NOT IN (SELECT oid FROM eco.t_unites);
SELECT * FROM eco.t_types_articles;
TRUNCATE eco.t_articles;
INSERT INTO eco.t_articles(code, texte, texte_court, code_original)
SELECT DISTINCT ARARTI, ARLI40, ARLI15, ARIUAR
FROM prod_shs.PIGEFI180_ARP01 LEFT JOIN eco.t_articles ON (code_original = ARIUAR)
WHERE code_original IS NULL;
INSERT INTO eco.t_articles(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseigné', 'Non renseigné'
WHERE 0 NOT IN (SELECT oid FROM eco.t_articles);
UPDATE eco.t_articles SET
type_id = COALESCE(t_types_articles.oid,0),
famille_id = COALESCE(t_familles_articles.oid,0),
sous_famille_id = COALESCE(t_sous_familles_articles.oid,0),
categorie_id = COALESCE(t_categories_articles.oid,0),
sous_categorie_id = COALESCE(t_sous_categories_articles.oid,0),
unite_stockage_id = COALESCE(t_unites_stockage.oid,0),
unite_distribution_id = COALESCE(t_unites_distribution.oid,0)
FROM prod_shs.PIGEFI180_ARP01
LEFT JOIN eco.t_types_articles ON ARTYAG = t_types_articles.code_original
LEFT JOIN eco.t_familles_articles ON ARKFS1 = t_familles_articles.code_original
LEFT JOIN eco.t_sous_familles_articles ON ARKFS2 = t_sous_familles_articles.code_original
LEFT JOIN eco.t_categories_articles ON ARKCAT = t_categories_articles.code_original
LEFT JOIN eco.t_sous_categories_articles ON ARKSCA = t_sous_categories_articles.code_original
LEFT JOIN eco.t_unites t_unites_stockage ON ARKUST = t_unites_stockage.code_original
LEFT JOIN eco.t_unites t_unites_distribution ON ARKUST = t_unites_distribution.code_original
WHERE
t_articles.code_original = ARIUAR AND
(t_articles.type_id IS DISTINCT FROM COALESCE(t_types_articles.oid,0) OR
t_articles.famille_id IS DISTINCT FROM COALESCE(t_familles_articles.oid,0) OR
t_articles.sous_famille_id IS DISTINCT FROM COALESCE(t_sous_familles_articles.oid,0) OR
t_articles.categorie_id IS DISTINCT FROM COALESCE(t_categories_articles.oid,0) OR
t_articles.sous_categorie_id IS DISTINCT FROM COALESCE(t_sous_categories_articles.oid,0) OR
t_articles.unite_stockage_id IS DISTINCT FROM COALESCE(t_unites_stockage.oid,0) OR
t_articles.unite_distribution_id IS DISTINCT FROM COALESCE(t_unites_distribution.oid,0)
);
UPDATE eco.t_articles SET
type_code = t_types_articles.code,
type_texte = t_types_articles.texte_court,
type_section_id = t_types_articles.section_id,
type_section_code = t_types_articles.section_code,
type_section_texte = t_types_articles.section_texte,
famille_code = t_familles_articles.code,
famille_texte = t_familles_articles.texte_court,
famille_section_id = t_familles_articles.section_id,
famille_section_code = t_familles_articles.section_code,
famille_section_texte = t_familles_articles.section_texte,
sous_famille_code = t_sous_familles_articles.code,
sous_famille_texte = t_sous_familles_articles.texte_court,
sous_famille_section_id = t_sous_familles_articles.section_id,
sous_famille_section_code = t_sous_familles_articles.section_code,
sous_famille_section_texte = t_sous_familles_articles.section_texte,
categorie_code = t_categories_articles.code,
categorie_texte = t_categories_articles.texte_court,
categorie_section_id = t_categories_articles.section_id,
categorie_section_code = t_categories_articles.section_code,
categorie_section_texte = t_categories_articles.section_texte,
sous_categorie_code = t_sous_categories_articles.code,
sous_categorie_texte = t_sous_categories_articles.texte_court,
sous_categorie_section_id = t_sous_categories_articles.section_id,
sous_categorie_section_code = t_sous_categories_articles.section_code,
sous_categorie_section_texte = t_sous_categories_articles.section_texte,
unite_stockage_code = t_unites_stockage.code,
unite_stockage_texte = t_unites_stockage.texte_court,
unite_stockage_section_id = t_unites_stockage.section_id,
unite_stockage_section_code = t_unites_stockage.section_code,
unite_stockage_section_texte = t_unites_stockage.section_texte,
unite_distribution_code = t_unites_distribution.code,
unite_distribution_texte = t_unites_distribution.texte_court,
unite_distribution_section_id = t_unites_distribution.section_id,
unite_distribution_section_code = t_unites_distribution.section_code,
unite_distribution_section_texte = t_unites_distribution.section_texte
FROM eco.t_types_articles ,
eco.t_familles_articles,
eco.t_sous_familles_articles,
eco.t_categories_articles,
eco.t_sous_categories_articles,
eco.t_unites t_unites_stockage,
eco.t_unites t_unites_distribution
WHERE type_id = t_types_articles.oid
AND famille_id = t_familles_articles.oid
AND sous_famille_id = t_sous_familles_articles.oid
AND categorie_id = t_categories_articles.oid
AND sous_categorie_id = t_sous_categories_articles.oid
AND unite_stockage_id = t_unites_stockage.oid
AND unite_distribution_id = t_unites_distribution.oid
AND (
type_code IS DISTINCT FROM t_types_articles.code OR
type_texte IS DISTINCT FROM t_types_articles.texte_court OR
type_section_id IS DISTINCT FROM t_types_articles.section_id OR
type_section_code IS DISTINCT FROM t_types_articles.section_code OR
type_section_texte IS DISTINCT FROM t_types_articles.section_texte OR
famille_code IS DISTINCT FROM t_familles_articles.code OR
famille_texte IS DISTINCT FROM t_familles_articles.texte_court OR
famille_section_id IS DISTINCT FROM t_familles_articles.section_id OR
famille_section_code IS DISTINCT FROM t_familles_articles.section_code OR
famille_section_texte IS DISTINCT FROM t_familles_articles.section_texte OR
sous_famille_code IS DISTINCT FROM t_sous_familles_articles.code OR
sous_famille_texte IS DISTINCT FROM t_sous_familles_articles.texte_court OR
sous_famille_section_id IS DISTINCT FROM t_sous_familles_articles.section_id OR
sous_famille_section_code IS DISTINCT FROM t_sous_familles_articles.section_code OR
sous_famille_section_texte IS DISTINCT FROM t_sous_familles_articles.section_texte OR
categorie_code IS DISTINCT FROM t_categories_articles.code OR
categorie_texte IS DISTINCT FROM t_categories_articles.texte_court OR
categorie_section_id IS DISTINCT FROM t_categories_articles.section_id OR
categorie_section_code IS DISTINCT FROM t_categories_articles.section_code OR
categorie_section_texte IS DISTINCT FROM t_categories_articles.section_texte OR
sous_categorie_code IS DISTINCT FROM t_sous_categories_articles.code OR
sous_categorie_texte IS DISTINCT FROM t_sous_categories_articles.texte_court OR
sous_categorie_section_id IS DISTINCT FROM t_sous_categories_articles.section_id OR
sous_categorie_section_code IS DISTINCT FROM t_sous_categories_articles.section_code OR
sous_categorie_section_texte IS DISTINCT FROM t_sous_categories_articles.section_texte OR
t_articles.unite_stockage_code IS DISTINCT FROM t_unites_stockage.code OR
t_articles.unite_stockage_texte IS DISTINCT FROM t_unites_stockage.texte_court OR
t_articles.unite_stockage_section_id IS DISTINCT FROM t_unites_stockage.section_id OR
t_articles.unite_stockage_section_code IS DISTINCT FROM t_unites_stockage.section_code OR
t_articles.unite_stockage_section_texte IS DISTINCT FROM t_unites_stockage.section_texte OR
t_articles.unite_distribution_code IS DISTINCT FROM t_unites_distribution.code OR
t_articles.unite_distribution_texte IS DISTINCT FROM t_unites_distribution.texte_court OR
t_articles.unite_distribution_section_id IS DISTINCT FROM t_unites_distribution.section_id OR
t_articles.unite_distribution_section_code IS DISTINCT FROM t_unites_distribution.section_code OR
t_articles.unite_distribution_section_texte IS DISTINCT FROM t_unites_distribution.section_texte
);
UPDATE eco.t_articles SET
type_code = t_types_articles.code,
type_texte = t_types_articles.texte_court,
type_section_id = t_types_articles.section_id,
type_section_code = t_types_articles.section_code,
type_section_texte = t_types_articles.section_texte,
famille_code = t_familles_articles.code,
famille_texte = t_familles_articles.texte_court,
famille_section_id = t_familles_articles.section_id,
famille_section_code = t_familles_articles.section_code,
famille_section_texte = t_familles_articles.section_texte,
sous_famille_code = t_sous_familles_articles.code,
sous_famille_texte = t_sous_familles_articles.texte_court,
sous_famille_section_id = t_sous_familles_articles.section_id,
sous_famille_section_code = t_sous_familles_articles.section_code,
sous_famille_section_texte = t_sous_familles_articles.section_texte,
categorie_code = t_categories_articles.code,
categorie_texte = t_categories_articles.texte_court,
categorie_section_id = t_categories_articles.section_id,
categorie_section_code = t_categories_articles.section_code,
categorie_section_texte = t_categories_articles.section_texte,
sous_categorie_code = t_sous_categories_articles.code,
sous_categorie_texte = t_sous_categories_articles.texte_court,
sous_categorie_section_id = t_sous_categories_articles.section_id,
sous_categorie_section_code = t_sous_categories_articles.section_code,
sous_categorie_section_texte = t_sous_categories_articles.section_texte,
unite_stockage_code = t_unites_stockage.code,
unite_stockage_texte = t_unites_stockage.texte_court,
unite_stockage_section_id = t_unites_stockage.section_id,
unite_stockage_section_code = t_unites_stockage.section_code,
unite_stockage_section_texte = t_unites_stockage.section_texte,
unite_distribution_code = t_unites_distribution.code,
unite_distribution_texte = t_unites_distribution.texte_court,
unite_distribution_section_id = t_unites_distribution.section_id,
unite_distribution_section_code = t_unites_distribution.section_code,
unite_distribution_section_texte = t_unites_distribution.section_texte
FROM eco.t_types_articles ,
eco.t_familles_articles,
eco.t_sous_familles_articles,
eco.t_categories_articles,
eco.t_sous_categories_articles,
eco.t_unites t_unites_stockage,
eco.t_unites t_unites_distribution
WHERE type_id = t_types_articles.oid
AND famille_id = t_familles_articles.oid
AND sous_famille_id = t_sous_familles_articles.oid
AND categorie_id = t_categories_articles.oid
AND sous_categorie_id = t_sous_categories_articles.oid
AND unite_stockage_id = t_unites_stockage.oid
AND unite_distribution_id = t_unites_distribution.oid
AND (
type_code IS DISTINCT FROM t_types_articles.code OR
type_texte IS DISTINCT FROM t_types_articles.texte_court OR
type_section_id IS DISTINCT FROM t_types_articles.section_id OR
type_section_code IS DISTINCT FROM t_types_articles.section_code OR
type_section_texte IS DISTINCT FROM t_types_articles.section_texte OR
famille_code IS DISTINCT FROM t_familles_articles.code OR
famille_texte IS DISTINCT FROM t_familles_articles.texte_court OR
famille_section_id IS DISTINCT FROM t_familles_articles.section_id OR
famille_section_code IS DISTINCT FROM t_familles_articles.section_code OR
famille_section_texte IS DISTINCT FROM t_familles_articles.section_texte OR
sous_famille_code IS DISTINCT FROM t_sous_familles_articles.code OR
sous_famille_texte IS DISTINCT FROM t_sous_familles_articles.texte_court OR
sous_famille_section_id IS DISTINCT FROM t_sous_familles_articles.section_id OR
sous_famille_section_code IS DISTINCT FROM t_sous_familles_articles.section_code OR
sous_famille_section_texte IS DISTINCT FROM t_sous_familles_articles.section_texte OR
categorie_code IS DISTINCT FROM t_categories_articles.code OR
categorie_texte IS DISTINCT FROM t_categories_articles.texte_court OR
categorie_section_id IS DISTINCT FROM t_categories_articles.section_id OR
categorie_section_code IS DISTINCT FROM t_categories_articles.section_code OR
categorie_section_texte IS DISTINCT FROM t_categories_articles.section_texte OR
sous_categorie_code IS DISTINCT FROM t_sous_categories_articles.code OR
sous_categorie_texte IS DISTINCT FROM t_sous_categories_articles.texte_court OR
sous_categorie_section_id IS DISTINCT FROM t_sous_categories_articles.section_id OR
sous_categorie_section_code IS DISTINCT FROM t_sous_categories_articles.section_code OR
sous_categorie_section_texte IS DISTINCT FROM t_sous_categories_articles.section_texte OR
t_articles.unite_stockage_code IS DISTINCT FROM t_unites_stockage.code OR
t_articles.unite_stockage_texte IS DISTINCT FROM t_unites_stockage.texte_court OR
t_articles.unite_stockage_section_id IS DISTINCT FROM t_unites_stockage.section_id OR
t_articles.unite_stockage_section_code IS DISTINCT FROM t_unites_stockage.section_code OR
t_articles.unite_stockage_section_texte IS DISTINCT FROM t_unites_stockage.section_texte OR
t_articles.unite_distribution_code IS DISTINCT FROM t_unites_distribution.code OR
t_articles.unite_distribution_texte IS DISTINCT FROM t_unites_distribution.texte_court OR
t_articles.unite_distribution_section_id IS DISTINCT FROM t_unites_distribution.section_id OR
t_articles.unite_distribution_section_code IS DISTINCT FROM t_unites_distribution.section_code OR
t_articles.unite_distribution_section_texte IS DISTINCT FROM t_unites_distribution.section_texte
);
select * from eco.t_articles limit 1000;
TRUNCATE eco.t_fournisseurs;
INSERT INTO eco.t_fournisseurs(code, texte, texte_court, code_original)
SELECT DISTINCT FNFOUR, FNNOMF, FNABRG, FNIUFN
FROM prod_shs.PIGEFI180_FNP01 LEFT JOIN eco.t_fournisseurs ON (code_original = FNIUFN)
WHERE code_original IS NULL;
INSERT INTO eco.t_fournisseurs(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseigné', 'Non renseigné'
WHERE 0 NOT IN (SELECT oid FROM eco.t_fournisseurs);
UPDATE eco.t_fournisseurs SET
type_id = COALESCE(t_types_fournisseurs.oid,0)
FROM prod_shs.PIGEFI180_FNP01
LEFT JOIN eco.t_types_fournisseurs ON FNKTYF = t_types_fournisseurs.code_original
WHERE
t_fournisseurs.code_original = FNIUFN AND
(t_fournisseurs.type_id IS DISTINCT FROM COALESCE(t_types_fournisseurs.oid,0));
UPDATE eco.t_fournisseurs SET type_id = 0
WHERE type_id IS NULL;
UPDATE eco.t_fournisseurs SET
type_code = t_types_fournisseurs.code,
type_texte = t_types_fournisseurs.texte_court,
type_section_id = t_types_fournisseurs.section_id,
type_section_code = t_types_fournisseurs.section_code,
type_section_texte = t_types_fournisseurs.section_texte
FROM eco.t_types_fournisseurs
WHERE type_id = t_types_fournisseurs.oid
AND (
type_code IS DISTINCT FROM t_types_fournisseurs.code OR
type_texte IS DISTINCT FROM t_types_fournisseurs.texte_court OR
type_section_id IS DISTINCT FROM t_types_fournisseurs.section_id OR
type_section_code IS DISTINCT FROM t_types_fournisseurs.section_code OR
type_section_texte IS DISTINCT FROM t_types_fournisseurs.section_texte
);
SELECT * FROm eco.t_fournisseurs;
TRUNCATE eco.t_types_mouvements;
INSERT INTO eco.t_types_mouvements(code, texte, texte_court, code_original)
SELECT DISTINCT THCODE, MAX(THLI40), MAX(THLI40), THCODE
FROM prod_shs.PIGEFI180_THP02GE LEFT JOIN eco.t_types_mouvements ON (code_original = THCODE)
WHERE THCENR = 'CMV' AND code_original IS NULL
GROUP BY 1;
INSERT INTO eco.t_types_mouvements(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseigné', 'Non renseigné'
WHERE 0 NOT IN (SELECT oid FROM eco.t_types_mouvements);
INSERT INTO eco.t_types_mouvements(code_original, code, texte, texte_court)
SELECT 'CTI_STOCK', 'CTI_STOCK', 'Stock début de mois', 'Stock début de mois'
WHERE 'CTI_STOCK' NOT IN (SELECT code_original FROM eco.t_types_mouvements);
TRUNCATE eco.t_lieux;
INSERT INTO eco.t_lieux(code, texte, texte_court, code_original)
SELECT ZLLIEU, ZLNLIE, ZLNLIE, ZLLIEU
FROM prod_shs.PIGEFI180_ZLP01 LEFT JOIN eco.t_lieux ON (code_original = ZLLIEU)
WHERE code_original IS NULL;
INSERT INTO eco.t_lieux(code, texte, texte_court, code_original)
SELECT ZYLIEU, ZYNLIE, ZYNLIE, ZYLIEU
FROM prod_shs.PIGEFI180_ZYP01 LEFT JOIN eco.t_lieux ON (code_original = ZYLIEU)
WHERE code_original IS NULL;
INSERT INTO eco.t_lieux(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseigné', 'Non renseigné'
WHERE 0 NOT IN (SELECT oid FROM eco.t_lieux);
TRUNCATE eco.t_centres_responsabilites;
INSERT INTO eco.t_centres_responsabilites(code, texte, texte_court, code_original)
SELECT RCCICR, RCLI25, RCLI25, RCIURC
FROM prod_shs.PIGEFI180_RCP01 LEFT JOIN eco.t_centres_responsabilites ON (code_original = RCIURC)
WHERE code_original IS NULL;
INSERT INTO eco.t_centres_responsabilites(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseigné', 'Non renseigné'
WHERE 0 NOT IN (SELECT oid FROM eco.t_centres_responsabilites);
TRUNCATE eco.t_unites_fonctionnelles;
INSERT INTO eco.t_unites_fonctionnelles(code, texte, texte_court, code_original)
SELECT UFCIUF, UFNMUF, UFNMUF, UFIUUF
FROM prod_shs.PIGEFI180_UFP01GE LEFT JOIN eco.t_unites_fonctionnelles ON (code_original = UFIUUF)
WHERE code_original IS NULL;
INSERT INTO eco.t_unites_fonctionnelles(oid, code_original, code, texte, texte_court)
SELECT 0, '', chr(127) || '*', 'Non renseignée', 'Non renseignée'
WHERE 0 NOT IN (SELECT oid FROM eco.t_unites_fonctionnelles);
SELECT * FROM eco.t_fournisseurs where type_id > 0
limit 100;