I have many existing tables, each with a column called 'id'. This column has an integer value starting at 1. So for example, the table MY_TABLE contains 3 records with ids 1, 2 and 3 (super basic).
I want to create a sequence for each table I have and set its start value with the maximun id of the table. In my example, I would need something like this:
CREATE SEQUENCE MY_TABLE_SEQ START WITH 3 INCREMENT BY 1;
I tried something like this, but it didn't work:
CREATE SEQUENCE MY_TABLE_SEQ START WITH (SELECT NVL(MAX(id),1) FROM MY_TABLE) INCREMENT BY 1;
Any idea what I might be able to do?
Thanks