How to remove gap in sequence?
Hi,
SELECT MENU_ITEMID.NEXTVAL INTO :MENU_ITEM.M_ITEM_ID
FROM SYS.DUAL;
EXCEPTION
WHEN OTHERS THEN MESSAGE ('FAILED');
RAISE FORM_TRIGGER_FAILURE;
I have applied the above PRE-INSERT trigger on my MENU_ITEM FORM.
I was inserting values but when I was inserting the 53th item my PC was struck by a power failure, I did not commit or Rollback and next item when I rebooted my system and tried to insert the 53th item in my form it gave me a gap and jumped to 54th item directly.
Now How can I remove this gap?
I tried to insert the ids manually using INSERT command,
INSERT INTO MENU_ITEM VALUES (53, 'AAAA');
INSERT INTO MENU_ITEM VALUES (54, 'BBAAA');
INSERT INTO MENU_ITEM VALUES (55, 'UUAA');
but when I opened the application form then it showed the wrong order of id column.
like
53
55
54
and so on.
I deleted the newly inserted records using this command, DELETE from MENU_ITEM where M_ITEM_ID in(53,54,55);
COMMIT;
and then i queried the nextval of sequence.
and it was 55.
now I want tthe solution to solve this.
Please Help me that where I can find the solution?
Thanks In advance
Natalia