Updating an oracle sequence via plsql

posted by | Leave a comment

Now suppose I have reset the value of the SEQUENCE to 1 again. Follow all the steps in the same order as shown below: declare max_db_value number(10,0); cur_seq_value number(10,0); counter number(10,0); difference number(10,0); dummy_number number(10); begin -- enter table name here select max(id) into max_db_value from persons; -- enter sequence name here select last_number into cur_seq_value from user_sequences where sequence_name = 'SEQ_PERSONS'; difference := max_db_value - cur_seq_value; for counter in 1..difference loop -- change sequence name here as well select SEQ_PERSONS.nextval into dummy_number from dual; end loop; end; DECLARE actual_sequence_number INTEGER; max_number_from_table INTEGER; difference INTEGER; BEGIN SELECT SQ_CD_TP_TAXA_SERV.

CURRVAL INTO actual_sequence_number FROM DUAL; SELECT MAX(CD_TP_t AXA_SERV) INTO max_number_from_table FROM SIGA_TIPO_TAXA_SERVICO; SELECT (max_number_from_table-actual_sequence_number) 1 INTO difference FROM DUAL; --DBMS_OUTPUT.put_line (actual_sequence_number); --DBMS_OUTPUT.put_line (CONCAT('alter sequence sq_cd_tp_taxa_serv increment by ', difference)); EXECUTE IMMEDIATE CONCAT('alter sequence sq_cd_tp_taxa_serv increment by ', difference); END; Thank you for your interest in this question.

I have a Oracle database table with some fields (columns) in numeric format.

updating an oracle sequence via plsql-27updating an oracle sequence via plsql-84

NEXTVAL FROM DUAL' INTO l_next; END IF; END IF; -- Prepare Sequence for next use.

IF COALESCE( cycle_flag , next_value , increment_by , min_value , max_value , cache_size , order_flag) IS NOT NULL THEN EXECUTE IMMEDIATE 'ALTER SEQUENCE '

Leave a Reply

  1. process of liquidating a company 15-Dec-2014 09:02

    Interpol announced the arrest of 58 persons in the Philippines for sextortion, including one case where a 17-year-old victim committed suicide in July last year following blackmailing by the group.

  2. Masterbate with a male webcam chat 05-Jun-2014 19:10

    Tanpa lengah lidah kasar sudah bersarang di lurah nikmat. Aku lihat senjatanya keras terpacak dan cairan jernih keluar di hujung kepalanya yang membengkak tapi masih dibungkus kulit kulup.

Free chat raw sex