I have a problem with the execution of the procedure, exactly with the creation of the sequence. I am getting the error ORA-01031 - "insufficient privileges" even though the operation is being performed by the user "system". Code procedure:
CREATE OR REPLACE PROCEDURE my_proc_1
IS
l_seq_start_with number := 7;
begin
begin
execute immediate 'DROP SEQUENCE MY_SEQ';
exception
when others then null;
end;
execute immediate
'CREATE SEQUENCE MY_SEQ START WITH '
||to_char(l_seq_start_with)
||' INCREMENT BY 1 NOCACHE';
end;
/
Calling:
BEGIN
my_proc_1;
END;
The same operation in the anonymous block is performed correctly - a sequence is formed.