112 lines
3.3 KiB
SQL
112 lines
3.3 KiB
SQL
-- Customer specific once-script voor BLOS
|
|
|
|
-- $Id$
|
|
--
|
|
-- Oncescript om eenmalig alle bestaande locaties (+/- 270) een gekoppeld afleveradresde te geven - Ivm inrichten eProcurement
|
|
|
|
DEFINE thisfile = 'BLOS#72319.SQL'
|
|
DEFINE dbuser = '^BLOS'
|
|
|
|
SET ECHO ON
|
|
SET DEFINE ON
|
|
COLUMN fcltlogfile NEW_VALUE fcltlogfile NOPRINT;
|
|
WHENEVER SQLERROR EXIT;
|
|
SELECT adm.scriptspoolfile('&dbuser', '&thisfile') AS fcltlogfile FROM DUAL;
|
|
WHENEVER SQLERROR CONTINUE;
|
|
SPOOL &fcltlogfile
|
|
SET DEFINE OFF
|
|
|
|
|
|
------ payload begin ------
|
|
|
|
DECLARE
|
|
v_errormsg VARCHAR (200);
|
|
v_errorhint VARCHAR (200);
|
|
oracle_err_num NUMBER;
|
|
oracle_err_mes VARCHAR2 (150);
|
|
currentversion fac_module.fac_module_version%TYPE;
|
|
v_aanduiding VARCHAR (100);
|
|
v_count NUMBER;
|
|
v_alg_locatie_key NUMBER (10) ;
|
|
|
|
CURSOR c
|
|
IS
|
|
SELECT alg_locatie_key, alg_locatie_omschrijving, alg_locatie_adres, alg_locatie_postcode, alg_locatie_plaats, alg_locatie_land
|
|
FROM alg_locatie
|
|
WHERE alg_locatie_verwijder IS NULL ;
|
|
|
|
BEGIN
|
|
|
|
FOR rec IN c
|
|
LOOP
|
|
BEGIN
|
|
|
|
SELECT a.alg_locatie_key
|
|
INTO v_alg_locatie_key
|
|
FROM mld_adres a
|
|
WHERE a.alg_locatie_key = rec.alg_locatie_key
|
|
AND a.mld_adres_verwijder IS NULL ;
|
|
EXCEPTION WHEN NO_DATA_FOUND
|
|
THEN
|
|
|
|
INSERT INTO mld_adres (mld_adres_contactpers_bureau,
|
|
mld_adres_telefoon,
|
|
mld_adres_email,
|
|
mld_adres_naam,
|
|
mld_adres_bezoek_adres,
|
|
mld_adres_bezoek_postcode,
|
|
mld_adres_bezoek_plaats,
|
|
mld_adres_bezoek_land,
|
|
mld_adres_post_adres,
|
|
mld_adres_gebouw_ruimte,
|
|
mld_adres_post_postcode,
|
|
mld_adres_post_plaats,
|
|
mld_adres_post_land,
|
|
mld_adres_contactpersoon,
|
|
mld_adres_contactpers_telefoon,
|
|
mld_adres_contactpers_email,
|
|
mld_adres_factuuradres,
|
|
mld_adres_opdrachtadres,
|
|
mld_adres_afleveradres,
|
|
alg_locatie_key)
|
|
VALUES (NULL,
|
|
NULL,
|
|
NULL,
|
|
rec.alg_locatie_omschrijving, -- 'KCC',
|
|
rec.alg_locatie_adres, --'De Schans 19-09',
|
|
rec.alg_locatie_postcode, -- '8231 KM',
|
|
rec.alg_locatie_plaats, -- 'Lelystad',
|
|
rec.alg_locatie_land, -- 'Nederland',
|
|
rec.alg_locatie_adres, -- 'De Schans 19-09',
|
|
NULL,
|
|
rec.alg_locatie_postcode, --'8231 KM',
|
|
rec.alg_locatie_plaats, -- 'Lelystad',
|
|
rec.alg_locatie_land, --'Nederland',
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
1,
|
|
rec.alg_locatie_key) ; -- 17
|
|
|
|
|
|
END;
|
|
END LOOP;
|
|
|
|
END;
|
|
/
|
|
|
|
|
|
------ payload end ------
|
|
|
|
SET DEFINE OFF
|
|
BEGIN adm.systrackscriptId ('$Id$', 1); END;
|
|
/
|
|
|
|
COMMIT;
|
|
SET ECHO OFF
|
|
SPOOL OFF
|
|
SET DEFINE ON
|
|
PROMPT Logfile of this upgrade is: &fcltlogfile
|