src-db/database/model/functions/AD_UPDATE_SEQUENCE.xml
changeset 1605 8a0fe0193bef
parent 799 fef2c5e2feb7
child 6701 690d2af86089
--- a/src-db/database/model/functions/AD_UPDATE_SEQUENCE.xml	Wed Sep 03 17:10:52 2008 +0000
+++ b/src-db/database/model/functions/AD_UPDATE_SEQUENCE.xml	Wed Sep 03 17:55:37 2008 +0000
@@ -17,134 +17,10 @@
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
- TYPE RECORD IS REF CURSOR;
-   Cur_Script RECORD;
-   Cur_Tables RECORD;
-   v_NextNo NUMBER;
-   v_Aux NUMBER;
-   v_StartWith VARCHAR(10) ;
-   v_StartWithSys VARCHAR(10) ;
  BEGIN
-   select count(*)
-    into v_aux
-      from ad_sequence
-    where name='AD_Sequence';
-
-    if v_Aux=0 then
-      INSERT INTO AD_Sequence
-        (AD_Sequence_ID, AD_Client_ID, AD_Org_ID,
-        IsActive, Created, CreatedBy, Updated, UpdatedBy,
-        Name, Description,
-        IsAutoSequence, StartNo, IncrementNo, CurrentNextSys, CurrentNext,
-        IsTableID, StartNewYear)
-     VALUES
-        (1, 0, 0,
-        'Y', now(), 0, now(), 0,
-        'AD_Sequence', 'AD_Sequence',
-        'Y', 1000000, 1, 2, 0,
-        'Y', 'N');
-
-    end if;
-
-    --Update sequence for ad_update_sequence table
-    SELECT TAD_LEVEL INTO v_StartWithSys  FROM AD_SYSTEM  WHERE AD_SYSTEM_ID=0;
-    v_StartWith:=TO_CHAR(TO_NUMBER(v_StartWithSys) +1) || '00000';
-    v_StartWithSys:=v_StartWithSys || '00000';
-    UPDATE AD_SEQUENCE
-      SET CURRENTNEXT=(SELECT AD_SEQUENCE.INCREMENTNO +
-                                   (CASE SIGN(COALESCE((SELECT MAX(t.AD_Sequence_ID)
-                                                          FROM AD_Sequence t
-                                                          WHERE t.AD_Sequence_ID<TO_NUMBER(v_StartWith)),0)-TO_NUMBER(v_StartWithSys))
-                                    WHEN  -1  THEN TO_NUMBER(v_StartWithSys)-AD_SEQUENCE.INCREMENTNO
-                                    ELSE (SELECT MAX(t.AD_Sequence_ID)
-                                            FROM AD_Sequence t
-                                           WHERE t.AD_Sequence_ID<TO_NUMBER(v_StartWith))
-                                     END) AS SEQUENCE
-                             FROM AD_SEQUENCE
-                            WHERE UPPER(NAME) = 'AD_SEQUENCE')
-     WHERE UPPER(NAME) = 'AD_SEQUENCE';
-
-     UPDATE AD_SEQUENCE
-        SET CURRENTNEXTSYS=(SELECT AD_SEQUENCE.INCREMENTNO +
-                                  COALESCE((SELECT MAX(t.AD_SEQUENCE_ID)
-                                              FROM AD_SEQUENCE t
-                                             WHERE t.AD_SEQUENCE_ID<TO_NUMBER(v_StartWith)),(TO_NUMBER(v_StartWithSys)-AD_SEQUENCE.INCREMENTNO))
-                              FROM AD_SEQUENCE
-                             WHERE UPPER(NAME) = 'AD_SEQUENCE')
-       WHERE UPPER(NAME) = 'AD_SEQUENCE';
-
-
-     --Check for fac_acct_group sequence
-     select count(*)
-    into v_aux
-      from ad_sequence
-    where name='Fact_Acct_Group';
-
-    if v_Aux=0 then
-      AD_Sequence_Next('AD_Sequence', 0, v_NextNo);
-      INSERT INTO AD_Sequence
-        (AD_Sequence_ID, AD_Client_ID, AD_Org_ID,
-        IsActive, Created, CreatedBy, Updated, UpdatedBy,
-        Name, Description,
-        IsAutoSequence, IncrementNo, StartNo,
-        CurrentNextSys, CurrentNext,
-        IsTableID, StartNewYear)
-     VALUES
-        (v_NextNo, 0, 0,
-        'Y', now(), 0, now(), 0,
-        'Fact_Acct_Group', 'Fact_Acct_Group',
-        'Y', 1, 1000000,
-        (SELECT AD_SEQUENCE.INCREMENTNO +
-                COALESCE((SELECT MAX(t.Fact_Acct_Group_id)
-                            FROM FACT_ACCT t
-                           WHERE t.Fact_Acct_Group_id< TO_NUMBER(v_StartWith)),(TO_NUMBER(v_StartWithSys)-AD_SEQUENCE.INCREMENTNO))
-            FROM AD_SEQUENCE
-           WHERE UPPER(NAME) = 'AD_SEQUENCE'),
-        (SELECT AD_SEQUENCE.INCREMENTNO +
-               (CASE SIGN(COALESCE((SELECT MAX(t.Fact_Acct_Group_id)
-                                      FROM fact_acct t
-                                      WHERE t.Fact_Acct_Group_id<TO_NUMBER(v_StartWith)),0)-TO_NUMBER(v_StartWithSys))
-                WHEN  -1  THEN TO_NUMBER(v_StartWithSys)-AD_SEQUENCE.INCREMENTNO
-                ELSE (SELECT MAX(t.Fact_Acct_Group_id)
-                        FROM fact_acct t
-                       WHERE t.Fact_Acct_Group_id< TO_NUMBER(v_StartWith))
-                 END) AS SEQUENCE
-         FROM AD_SEQUENCE
-        WHERE UPPER(NAME) = 'AD_SEQUENCE'),
-        'Y', 'N');
-    end if;
-
-     FOR Cur_Tables IN (
-     SELECT AD_TABLE_ID, TABLENAME
-     FROM AD_TABLE
-     WHERE NOT EXISTS (SELECT 1
-                       FROM AD_SEQUENCE
-                       WHERE AD_SEQUENCE.NAME = AD_TABLE.TABLENAME
-                         AND AD_SEQUENCE.AD_CLIENT_ID = 0)
-     ) LOOP
-     --  Get next number
-     AD_Sequence_Next('AD_Sequence', 0, v_NextNo);
-
-     --  Insert
-     INSERT INTO AD_Sequence
-        (AD_Sequence_ID, AD_Client_ID, AD_Org_ID,
-        IsActive, Created, CreatedBy, Updated, UpdatedBy,
-        Name, Description,
-        IsAutoSequence, StartNo, IncrementNo, CurrentNextSys, CurrentNext,
-        IsTableID, StartNewYear)
-     VALUES
-        (v_NextNo, 0, 0,
-        'Y', now(), 0, now(), 0,
-        Cur_Tables.TABLENAME, Cur_Tables.TABLENAME,
-        'Y', 1000000, 1, 0, 0,
-        'Y', 'N');
-   END LOOP;                DELETE FROM AD_SCRIPT_SQL;
-   AD_UPDATE_SEQUENCE_GENERATE() ;
-   FOR Cur_Script IN
-     (SELECT STRSQL FROM AD_SCRIPT_SQL)
-   LOOP
-     EXECUTE IMMEDIATE(Cur_Script.STRSQL) ;
-   END LOOP;
+   NULL;
+   
+   --do nothing, just maintained for bacward compatibility
 END AD_UPDATE_SEQUENCE
 ]]></body>
     </function>