Support > Database

Oracle Problem on adding new module

(1/5) > >>

Ahmad Said:
hi all i have aproblem in adding new module -----> uniqe constrain , the problem is get new id from the seq of module
i solve the one for adding componnet by adding id as select max(nvl(id,0))+ 1 from #__component, but with module untill now i cant

datahell:
Marked for fix.

muharihar:
try this....

execute this sql script from your oracle sql query/script tool:
-------------------------------------------------------------

DECLARE
   --SEQ_ELX_MODULES   
   --Replace ELX_ with your Elxis Table Prefix
   max_seq_elx_modules   NUMBER (12);
   id_elx_modules        NUMBER (12);
BEGIN
-- SEQ_ELX_MODULES = elx_MODULES
   SELECT NVL (MAX (a.ID), 1)
     INTO id_elx_modules
     FROM elx_modules a;

   SELECT seq_elx_modules.NEXTVAL
     INTO max_seq_elx_modules
     FROM DUAL;

   /*
   DBMS_OUTPUT.put_line (   'Tabel elx_MODULES, id = '
                         || id_elx_modules
                         || ', seq = '
                         || max_seq_elx_modules
                        );
   */
   IF id_elx_modules > max_seq_elx_modules
   THEN
       /*
      DBMS_OUTPUT.put_line ('Looping...');
      */
      WHILE max_seq_elx_modules < id_elx_modules
      LOOP
           /*
         DBMS_OUTPUT.put_line (   ' - increment id = '
                                 || id_elx_modules
                                 || ', seq = '
                                 || max_seq_elx_modules
                                );
           */
         IF max_seq_elx_modules > id_elx_modules
         THEN
            EXIT;
         END IF;

         SELECT seq_elx_modules.NEXTVAL
           INTO max_seq_elx_modules
           FROM DUAL;
      END LOOP;
   END IF;
END;


------------------------------------------
if you want to use this query (srcipt) for another sequence problem, replace "ELX_" with your Elxis Table Prefix.... ;D

thank....
sorry for my english....

Ahmad Said:
grat muharihar
am try it and its work 100%

batorgil:
How can I install Elxis with oracle 10g, windows. Pls help me.

Navigation

[0] Message Index

[#] Next page

Go to full version