Monday 20 April 2020

How to get next value of Sequence dynamically in Oracle

we can execute sequence and get its value using Execute Immediate.
here is the Example Code;

CREATE SEQUENCE mySEQ START WITH 1 INCREMENT BY 1 MINVALUE 1 MAXVALUE 1000000 NOCYCLE NOCACHE ORDER

declare
  SequenceValue number;
begin
    EXECUTE IMMEDIATE 'select mySEQ.nextval  from dual' INTO SequenceValue;
    ---Now you can Use SequenceValue anywhere
end;
/

drop sequence mySEQ 

/

No comments:

Post a Comment

OADBTransactionImpl in Oracle Application Framework (OAF)

OADBTransactionImpl is a class in Oracle Application Framework (OAF), which is a framework for building Oracle E-Business Suite applications...