PL SQL Code to Reset Sequence Every Day


I found two methods to reset a sequence daily.

First approach is using a function and a profile option.

Below function is used to reset the sequence every day. It is not advisable to use a sequence in this manner, but for a requirement I had to reset a sequence every day.

This method uses a profile option named ‘XX_SEQ_DATE’ to store current date. It has to be initialized, and the parameter p_user_id needs to be set from fnd_user value.

A sequence is created using:

CREATE SEQUENCE XX_SEQ
START WITH 1
MAXVALUE 99
MINVALUE 1
CYCLE
NOCACHE
NOORDER
/
Continue reading

Advertisements