pour déploiement auto v2 via gitlab
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.
 
 

38 lines
1.0 KiB

-- 1/3 : Création de la table temporaire
DROP TABLE IF EXISTS w_dbsetup
;
CREATE TEMP TABLE w_dbsetup AS
SELECT
t_etude_bariatrique.cdc, t_etude_bariatrique.seuil, t_etude_bariatrique.section_code, t_etude_bariatrique.liste_code
FROM pmsi.t_etude_bariatrique
ORDER BY 1
LIMIT 0
;
-- 2/3 : Peuplement de la table temporaire
INSERT INTO w_dbsetup(
cdc,
seuil,
section_code,
liste_code
)
VALUES
('2022', 50, 'POSE_CHANGEMENT_ANNEAU', 'ETUDE_BARIATRIQUE_2022'),
('2022', 50, 'COURT_CIRCUIT_GASTRIQUE', 'ETUDE_BARIATRIQUE_2022'),
('2022', 50, 'GASTRECTOMIE_LONGITUDINALE_MANCHON', 'ETUDE_BARIATRIQUE_2022'),
('2022', 50, 'GASTROPLASTIE_VERTICALE_CALIBREE', 'ETUDE_BARIATRIQUE_2022'),
('2022', 50, 'COURT_CIRCUIT_BILIOPANCREATIQUE_OU_INTESTINAL', 'ETUDE_BARIATRIQUE_2022')
;
-- 3/3 : Màj de la table iCTI
TRUNCATE pmsi.t_etude_bariatrique;
INSERT INTO pmsi.t_etude_bariatrique(cdc, seuil, section_code, liste_code)
SELECT
w_dbsetup.cdc,
w_dbsetup.seuil,
w_dbsetup.section_code,
w_dbsetup.liste_code
FROM w_dbsetup
;