When a database was imported yesterday, the user reflected that the sequence imported was smaller than the sequence value already imported into the table. The cause is that seq import may be performed in the production data, leading to repeated operations. To solve this problem, I extend all sequence of the current user to 200. The specific operation is as follows: Create Table mahanso_test (ID number, sequence varchar2 (100 )) declare cursor c_cursor is select sequence_name from user_sequences; v_sequences_name user_sequences.sequence_name % type; v_ SQL varchar2 (2000); v_insert_ SQL varchar2 (2000); v_sequences_value number; begin -- implicitly open the cursor for v_sequences_name in c_cursor loop -- implicitly execute a fetch statement for int in 1 .. 1000 loop v_ SQL: = 'select' | v_sequences_name.sequence_name | '. nextval from dual '; -- v_ SQL: = v_sequences_name; -- merge (v_ SQL); execute immediate v_ SQL into v_sequences_value; v_insert_ SQL: = 'insert into mahanso_test values (: 1,: 2 )'; execute immediate v_insert_ SQL using v_sequences_value, v_sequences_name.sequence_name; commit; end loop; -- implicitly monitor c_sal % notfound end loop; -- implicitly close the cursor end;
Note: This script was modified online.