--
-- $Id$
--
-- Customer specific once-script KLIM#53647.SQL.

DEFINE thisfile = 'KLIM#53647.SQL'
DEFINE dbuser   = '^KLIM'

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

DROP PROCEDURE grkl_import_perslid_mut;
DROP PROCEDURE grkl_update_perslid_mut;

DROP VIEW grkl_v_res_daglijst;
DROP VIEW grkl_v_noti_leidinggevende;
DROP VIEW grkl_v_rap_cmdb;
DROP VIEW grkl_v_export_cmdb;

UPDATE fac_version
   SET fac_version_cust = 'KLIM'
 WHERE fac_version_cust = 'GRKL';

UPDATE fac_setting
   SET fac_setting_pvalue = REPLACE (fac_setting_pvalue, 'GRKL', 'KLIM')
 WHERE fac_setting_pvalue LIKE '%GRKL%';

UPDATE fac_setting
   SET fac_setting_pvalue = REPLACE (fac_setting_pvalue, 'grkl', 'klim')
 WHERE fac_setting_pvalue LIKE '%grkl%';

UPDATE fac_export_app
   SET fac_export_app_prefix = 'KLIM'
 WHERE fac_export_app_prefix = 'GRKL';

UPDATE fac_import_app
   SET fac_import_app_prefix = 'KLIM'
 WHERE fac_import_app_prefix = 'GRKL';

UPDATE fac_notificatie_job
   SET fac_notificatie_job_view = REPLACE (fac_notificatie_job_view, 'GRKL', 'KLIM')
 WHERE fac_notificatie_job_view LIKE 'GRKL%';

-- Vanwege constraints moeten hernoemde views wel bestaan!
UPDATE fac_usrrap
   SET fac_usrrap_view_name = REPLACE (fac_usrrap_view_name, 'GRKL', 'KLIM')
 WHERE fac_usrrap_view_name LIKE 'GRKL%';

UPDATE fac_usrrap
   SET fac_usrrap_view_name = REPLACE (fac_usrrap_view_name, 'grkl', 'klim')
 WHERE fac_usrrap_view_name LIKE 'grkl%';

-- Geen fac_mgtrap_view_name
-- Geen fac_usrgraph_view_name

-- Geen cad_label_view
-- Geen cad_thema_view

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