--
-- $Id$
--
-- Script containing customer specific sql statements for the STCH database

DEFINE thisfile = 'STCH.SQL'
DEFINE dbuser   = 'STCH'

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 ------

UPDATE fac_version
SET fac_version_cust = 'STCH'
WHERE fac_version_cust = 'AASI';

BEGIN
   FOR rec
      IN (  SELECT prs_perslid_key
              FROM prs_perslid
             WHERE prs_perslid_verwijder IS NULL
                   AND prs_perslid_email LIKE '%dsm.com%'
          ORDER BY 1)
   LOOP
      BEGIN
         prs.delete_perslid (1, rec.prs_perslid_key);
      END;
   END LOOP;
END;
/

------ payload end   ------

SET DEFINE OFF
BEGIN adm.systrackscriptId ('$Id$', 0); END;
/

COMMIT;
SET ECHO OFF
SPOOL OFF
SET DEFINE ON
PROMPT Logfile of this upgrade is: &fcltlogfile