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!