SET ECHO ON
SPOOL xAKZA#32120.lst
SET DEFINE OFF;

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(prs_perslid_telefoonnr, '*', '+')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND prs_perslid_telefoonnr LIKE '*%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(prs_perslid_telefoonnr, '=', '+')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND prs_perslid_telefoonnr LIKE '=%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '0031', '+31 ')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '0031%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '031', '+31 ')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '031%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '+26366', '+3126366')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '+26366%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '026366', '+3126366')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '026366%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '+31366', '+3126366')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '+31366%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '+31026366', '+3126366')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '+31026366%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '26366', '+3126366')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '26366%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '3126366', '+3126366')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '3126366%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '+3126366', '+31 88 969 ')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '+3126366%';

---

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '+3188268', '+31 88 268 ')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '+3188268%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '088268', '+31 88 268 ')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '088268%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '+3120502', '+31 20 502 ')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '+3120502%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '020502', '+31 20 502 ')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '020502%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '+31570679', '+31 570 679 ')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '+31570679%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '+3133467', '+31 33 467 ')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '+3133467%';

UPDATE prs_perslid
   SET prs_perslid_telefoonnr = REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '+3171308', '+31 71 308 ')
 WHERE prs_perslid_verwijder IS NULL
   AND prs_perslid_telefoonnr IS NOT NULL
   AND REPLACE(REPLACE(REPLACE(prs_perslid_telefoonnr, ' ', ''), '-', ''), '-', '') LIKE '+3171308%';

COMMIT;
SPOOL OFF

--SELECT DISTINCT prs_perslid_telefoonnr
--  FROM prs_perslid
-- WHERE prs_perslid_verwijder IS NULL
--   AND prs_perslid_telefoonnr IS NOT NULL
--   AND prs_perslid_telefoonnr NOT LIKE '+31 88 969 %'
--   AND prs_perslid_telefoonnr NOT LIKE '+31 88 268 %'
--   AND prs_perslid_telefoonnr NOT LIKE '+31 570 679 %'
--   AND prs_perslid_telefoonnr NOT LIKE '+31 20 502 %'
--   AND prs_perslid_telefoonnr NOT LIKE '+31 33 467 %'
--   AND prs_perslid_telefoonnr NOT LIKE '+31 71 308 %'
--   AND prs_perslid_telefoonnr NOT LIKE '+31 6 %'
--ORDER BY 1;