IBM Support

How to use Sequence in SQL >> SYNTAX SELECT SEQ_YFS_....NEXTVAL FROM DUAL >>keywords Alter SEQ increment, YFC0001: record already exists Task_ID

Question & Answer


Question

How to use Sequence in SQL >> SYNTAX SELECT SEQ_YFS_....NEXTVAL FROM DUAL >>keywords Alter SEQ increment, YFC0001: record already exists Task_ID

Cause

Answer

Pick a sequence that you want to get numbers of
For e.g.,
SEQ_YFS_SHIPMENT_NO

select SEQ_YFS_SHIPMENT_NO.nextval from dual

This will return a value 1,2,3 and so on

to Alter the sequence use the command

alter sequence SEQ_YFS_SHIPMENT_NO increment by 201000
do the transaction
alter sequence SEQ_YFS_SHIPMENT_NO increment by 1
do the transaction and confirm it is now one up from the last #

always remember to finish up with an increment by 1

In extremely rare situations you might have need to reset sequence to a lower value
This is done by
alter sequence SEQ_YFS_SHIPMENT_NO increment by -80
followed by an incr by 1

[{"Product":{"code":"SS6PEW","label":"IBM Sterling Order Management"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Historical Number

PRI49317

Product Synonym

[<p><b>]Fact[</b><p>]

Document Information

More support for:
IBM Sterling Order Management

Software version:
All

Document number:
175861

Modified date:
16 June 2018

UID

swg21536841

Manage My Notification Subscriptions