--
-- $Id$
--
-- Zet de sequence van de contracten verder dan de intern gebruikte contractnummers.

DEFINE thisfile = 'AAES#52736.SQL'
DEFINE dbuser   = '^AAES'
DEFINE custid   = 'AAES'

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_max_nummer_intern   NUMBER;
    v_count               NUMBER;
BEGIN
    SELECT MAX (fac.safe_to_number (cnt_contract_nummer_intern))
      INTO v_max_nummer_intern
      FROM cnt_contract;

    v_count := 0;

    WHILE v_count <= v_max_nummer_intern
    LOOP
        SELECT CNT_S_CNT_CONTRACT_KEY.NEXTVAL INTO v_count FROM DUAL;
    END LOOP;

--    DBMS_OUTPUT.put_line (v_count);
    COMMIT;
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

@@ &custid