Home > database > After the operation will not on the sequence
After the operation will not on the sequence
Time:10-03
Under table, create a key field, create a content increasing sequence as a key field,
But every time after the operation of the key content will change, is there any way can make the content of the original key is changeless, insert a new record at the same time the key automatically add new content again
CodePudding user response:
The building Lord, for example;
CodePudding user response:
Select (sequence) seq. Nextval as key, Tc ode The from T (table name);
In this way, every time after the run once in the PL/SQL, key content will change, but the code does not change,
Need every time after the operation of the key content don't change, can you tell me how should deal with?
CodePudding user response:
Don't use sequence,
Select rownum key, code from t
Or
Select row_number () over the key order by code, code from t