Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Application Import Problem: PL/SQL: ORA-02289: sequence does not exist

4064455Aug 20 2019 — edited Aug 22 2019

Hello all,

I am migrating an app between Apex instances and am having this issue:

PL/SQL: ORA-02289: sequence does not exist

The code being imported includes:

    SELECT     COUNT (*)

    INTO       V_SEQ

    FROM       ALL_OBJECTS 

    WHERE      OBJECT_TYPE = 'SEQUENCE'    AND    OWNER = 'ERT'

    AND        OBJECT_NAME = 'SEQ_AARON';

   

    IF V_SEQ = 0 THEN

        EXECUTE IMMEDIATE

        'CREATE SEQUENCE ERT.SEQ_AARON START WITH 1

                                   MAXVALUE 9999999999999999999999999999

                                   MINVALUE 1

                                   NOCYCLE

                                   NOCACHE

                                   ORDER';

    END IF;

    select max(SOMEID) into last_used from SOMETABLE;

    loop

        select ERT.SEQ_AARON.NEXTVAL into curr_seq from DUAL;

        if curr_seq >= last_used then exit; end if;

    end loop;   

When running the logic query, it returns zero, therefore should execute the sequence creation script. However, it's not doing that and I don't know why. Any ideas how to troubleshoot this? Thanks!

Comments
Post Details
Added on Aug 20 2019
1 comment
1,280 views