--
-- $Id$
--
-- Markeer alle werkplekken/bezettingen als virtueel

DEFINE thisfile = 'PCHD#55959'
DEFINE dbuser   = '^PCHD'
DEFINE custid   = '^PCHD'

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 prs_werkplek
   SET prs_werkplek_virtueel = 1
 WHERE prs_werkplek_key IN
             (SELECT w.prs_werkplek_key
                FROM prs_werkplek w, prs_perslidwerkplek pw, prs_perslid p
               WHERE     w.prs_werkplek_key = pw.prs_werkplek_key
                     AND prs_werkplek_virtueel = 0
                     AND p.prs_perslid_key = pw.prs_perslid_key
                     AND p.prs_perslid_verwijder IS NULL);

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

SET DEFINE OFF
BEGIN adm.systrackscriptid('$Id$'); END;
/

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