Reset sequence

Hello

I created a sequence:

CREATE SEQUENCES ORDER_SEQ.

order of creation.

After that I used it a few times...

How can reset this sequence for 0 again (I can't change the sequence creation script, because it is limited)?

Thank you
Vinod

Correct way would be to drop the sequence and re-create it.

To restore order, you can use script below:

declare
  v_val   number;
begin
  select seq.nextval into v_val from dual;
  dbms_output.put_line('Value :: ' || v_val);
  execute immediate 'alter sequence seq increment by ' || ( 1 - v_val);
  select seq.nextval into v_val from dual;
  dbms_output.put_line('New Value :: ' || v_val);
  execute immediate 'alter sequence seq increment by 1';
end;

Tags: Database

Similar Questions

  • ORA-04092 immediate execution may engage in a trigger - Reset sequence

    Hi all. I'm trying to reset a sequence of a procedure that is triggered in a trigger. The reason is that after each new transaction, a new series of point number must be generated, numbering each line as 1, 2, 3... After a new transaction, I need to start from the beginning again. The procedure is
    PROCEDURE Reset_Item_Serial_No IS
      
        Serial_No  NUMBER;
        p_seq_name VARCHAR2(20);
      
      BEGIN
      
        p_seq_name := 'SERIAL_NO_SEQ';
      
        EXECUTE IMMEDIATE 'SELECT ' || p_seq_name || '.nextval FROM dual'
          INTO Serial_No;
      
        EXECUTE IMMEDIATE 'ALTER sequence ' || p_seq_name || ' INCREMENT BY -' ||
    
                          Serial_No || ' MINVALUE 0';
      
        EXECUTE IMMEDIATE 'SELECT ' || p_seq_name || '.nextval FROM dual'
          INTO Serial_No;
      
        EXECUTE IMMEDIATE 'ALTER sequence ' || p_seq_name ||
                          ' INCREMENT BY 1 MINVALUE 0';
      
      END;
    This procedure is triggered by the following section in the trigger:
     SELECT COUNT(*)
          INTO v_Reset_Sequence
          FROM supply_items s
         WHERE s.requisition_code = v_refno;
      
        IF v_Reset_Sequence = 0 THEN
        
          account_interface.reset_item_serial_no;
        
        END IF;
    I can not use TRANSACTION INDEPENDENT of PRAGMA, the db detects this and restores. Advice, is to make the enforcement procedure, or somehow create a sequence number, whenever I need to insert a new transaction?

    In your case, I'd rather not a sequence. As your requirment is transaction after I'd go with a GTB (global temporary Table).

    Here is an example.

    SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jan 27 14:58:12 2012
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    
    SQL> drop table test
      2  /
    
    Table dropped.
    
    SQL> create table test (no integer, name varchar2(10))
      2  /
    
    Table created.
    
    SQL> drop table test_seq_storage
      2  /
    
    Table dropped.
    
    SQL> create global temporary table test_seq_storage (seq integer) on commit delete rows
      2  /
    
    Table created.
    
    SQL> create or replace trigger test_bi_statement before insert on test
      2  declare
      3    lcount integer;
      4  begin
      5    select count(*) into lcount from test_seq_storage;
      6    if lcount = 0 then
      7      insert into test_seq_storage (seq) values(1);
      8    end if;
      9  end;
     10  /
    
    Trigger created.
    
    SQL> create or replace trigger test_bi_row before insert on test for each row
      2  declare
      3    lseq integer;
      4  begin
      5    select seq into lseq from test_seq_storage;
      6    :new.no := lseq;
      7    update test_seq_storage
      8       set seq = lseq+1;
      9  end;
     10  /
    
    Trigger created.
    
    SQL> show error
    No errors.
    SQL> select * from test
      2  /
    
    no rows selected
    
    SQL> insert into test (name)
      2  select 'karthick'
      3    from dual
      4  connect by level <= 5
      5  /
    
    5 rows created.
    
    SQL> select * from test
      2  /
    
            NO NAME
    ---------- ----------
             1 karthick
             2 karthick
             3 karthick
             4 karthick
             5 karthick
    
    SQL> insert into test (name)
      2  select 'Oracle'
      3    from dual
      4  connect by level <= 5
      5  /
    
    5 rows created.
    
    SQL> select * from test
      2  /
    
            NO NAME
    ---------- ----------
             1 karthick
             2 karthick
             3 karthick
             4 karthick
             5 karthick
             6 Oracle
             7 Oracle
             8 Oracle
             9 Oracle
            10 Oracle
    
    10 rows selected.
    
    SQL> commit
      2  /
    
    Commit complete.
    
    SQL> insert into test (name)
      2  select 'SQL'
      3    from dual
      4  connect by level <= 5
      5  /
    
    5 rows created.
    
    SQL> select * from test
      2  /
    
            NO NAME
    ---------- ----------
             1 karthick
             2 karthick
             3 karthick
             4 karthick
             5 karthick
             6 Oracle
             7 Oracle
             8 Oracle
             9 Oracle
            10 Oracle
             1 SQL
             2 SQL
             3 SQL
             4 SQL
             5 SQL
    
    15 rows selected.
    
    SQL> commit
      2  /
    
  • continuous reset sequence

    This encoding does not keep the number of course, if I put the next value (start with) where he needs to be
    the sequence works for the next few inserts that I try... but when I go back to work tomorrow its been reset to 0 and does not work...
    I don't know any alter or drop/create statement that is scheduled and running during the night...
    How to figure out which resets the next value in the sequence to 0?


    -Create sequence
    create the ROWBUSINESS sequence. LEDGER_SEQ
    MinValue 0
    MaxValue 9999999999999999999999999999
    Start with 4550
    Increment 1
    NoCache;

    -Trigger
    CREATE OR REPLACE TRIGGER "ROWBUSINESS". "" LEDGER_PK_TRIGGER ".
    BEFORE INSERT ON rowbusiness.ledger FOR EACH ROW
    When (NEW.n_pk IS NULL)
    Rowbusiness.ledger_seq START to SELECT. NEXTVAL INTO: DOUBLE NEW.n_pk; END;

    Hello

    To start, you can query the views of the dictionary (user_objects or object) to find the last DDL operation on the object. You will find if something is happening in the night...

    Good luck

  • Reset sequences of 10000

    Hi all

    I want to reset all my diagram of 10000 sequences.
    How to do?

    See you soon,.
    Malika

    user9131570 wrote:
    @Anantha... I did not understand the link you provided...

    Well, according to the time on your respective messages logs, you spent less than 2 minutes (if any) read the links provided.

    This will cause problems, perhaps spending a decent amount of time actually reading the articles (I recommend the AskTom one) with the intent to understand.

  • CHANGE the SEQUENCE on a busy server translates into very high unexpected values

    Our sequence was 782,393,232, or so, when I came it up through 30 000. Here are the commands I used:

    change the sequence of OUR_SEQ increment in 30000;
    Select double OUR_SEQ.nextval;
    change the sequence of OUR_SEQ increment in 1;
    commit;

    When I questioned nextval in the sequence, a few minutes later, he had climbed up to more 8 billion! I have reset quickly up to 783 million or more, and it behaved correctly after that. I saw some posts on the net that infer that the reset sequence is heavily used can cause "unpredictable." Everyone knows this or y at - it a bug known?

    I am running:

    Oracle Database 10 g Enterprise Edition Release 10.2.0.4.0 - 64 bit, RAC system.
    PL/SQL Release 10.2.0.4.0 - Production
    "CORE 10.2.0.4.0 Production."
    AMT for Linux: release 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production

    Sven,

    I'm not sure I understand what you're clarifying...

    In a CCR cluster, a sequence with a cache has a separate cache in each node of the cluster. If the cache has been set to 20 (the default), and the increase was set to 30,000, each node is hiding 20 values separated by 30 000. And caches would be overlapping (i.e. node A would get 20 values of 1-570 001, node B would get 20 600 001-1 170 001 values). I don't see that this is in contradiction with what I posted.

    Obviously, the presence of a cache creates a bit of a ride with when, exactly, you say that a sequence is incremented. The NEXT_VALUE in DBA_SEQUENCES is incremented by cache * interval when any node exhausts its cache. The NEXTVAL of a sequence for connections that hit a particular node will increase by interval every time another session gets the NEXTVAL of a sequence. The NEXTVAL of a sequence for connections on a different node is not affected by what is happening on the current node. What enlightenment do you? If so, I agree.

    user11300030,

    Discussion on the sequence of caching can provide insight into why none of the lines are between 780 million and 1 billion. It is quite possible that these values have been cached on one node other than the node where the pads were executed. Had caches was flushed not when change you the sequence, inserts run on these other nodes could have used this range values.

    Justin

  • Airport Extreme in brick after update firmware 7.7.7

    Error while trying to update the Airport Extreme (model A1521) firmware to version 7.7.7.  After clicking on "Refresh" for the EPA in the utility AirPort app on my MBP, it seemed like it was downloading and then restart, but then the "error during firmware update" message popped up.

    Then he disappeared from the AirPort Utility app. check the physical EPA, he got a quick Orange flashing light on.

    Perform a reset by mode on "soft" apple support  No change in status in the AirPort or LED utility.

    Perform a "hard" reset No change.

    Perform a reset "factory".  Solid green LED for 1 second, off for 1 second, then fixed Orange LED for 5 to 10 seconds, then orange flashing LED forever.

    Removed all connections to the EPAS, repeated above steps with identical results.

    Tried to plug the cable to all ports, a both MBP, then in a port to a different router.  No connection.

    Base from the bottom of the EPA to inspect the connection with the ohmmeter removed rubber physical reset button. Button contacts are open when not depressed, short circuit when pressed.

    EPA appears at all in the AirPort Utility (not in "Other WiFi devices" or the other).

    Pushing the reset button on the EPA has no effect, no matter how much time or when it is pushed.

    Once the power cord is removed and inserted, the indications are always the same, no matter what I do with the reset button. Green LED for 1 second, off for 1 second, Orange fixed for 5 to 10 seconds, then orange blinking forever.

    Interaction ONLY with the device, which had until this point was working perfectly for years, has been through the AirPort Utility software.  Physical interaction occurred after that the update of the firmware he bricked.  Simply, I do not understand how a botched firmware update might brick the MONKEY.  The default firmware must always be able to be loaded with the reset sequence.

    Help, please.

    You should not open it... Apple may have been told by replacing.

    Firmware updates are always dangerous... the airport less then most of the routers.

    However very rarely something can go wrong and the firmware written correctly to the ROM. This will leave the router in a State of broken forever. You need to replace unfortunately.

    He got a quick Orange flashing light on.

    Restore mode flashing quickly means that it is in...

    Perform a reset "factory".  Solid green LED for 1 second, off for 1 second, then fixed Orange LED for 5 to 10 seconds, then orange flashing LED forever.

    It flashes quickly or slowly forever?

    The ethernet light when you plug the ethernet cable?

    As far as I know, there is no firmware emergency repair method at airports... Apple has every confidence their sequence of upgrade to work, even when the firmware is delivered more wireless... always a big risk CF ethernet.

  • Software not implemented fingerprint reader

    I can't configure simplepass fingerprint reader software. I tried the HP Center utility icon. It doesn't do anything. I "ve also tried each executable file in the folder of the program simple and none of them pass doesn't make something else that travel the pop-up UAC to Hello run the eprogram th file. Is it possible, since it is a refurbished unit, it has not been correctly set up at HP?

    Thank you!!!

    Donald

    Hi Donald,.

    Welcome to the Community Forum of HP.

    I'm not the only one to help you with this; I never - ever - was able to get the version of series 8 HP SimplePass software works correctly.  When I was able to run, he soon blurred place a small ball of code-waddle.  Sigh.  I use the 6 series, the old version of AuthenTec's HP SimplePass - is no longer on the list official "support" but used by many and, oh, so strong and vigorous.

    However, series 8 is the official version of these days AND 8 series is the version that comes with the latest laptop computers.  Series 8 is the future.  We move.

    If - the following may be useful that everything else is equal, and the universe is not against you:

    Reference:

    ENVY of HP TouchSmart m7-j120dx Notebook PC drivers

    Open the file > click Download > click 'open in Adobe Reader.

    HP SimplePass upgrade instructions

    If your HP SimplePass is a heap of smoking rubble (broken):

    Jump down to about Page 10 (updated) - Look / search the Section Hard Reset séquence

    Next:

    See the Section on Page 2 (updated):

    HP SimplePass and fingerprint Scanner Support Document - Windows 8

    Then, if necessary:

    Better, you can complete the procedure / steps in the section:

    Procedure - updated / (install HP SimplePass Re)

    NOTES:

    • Observe the warnings that the series 6 and series 8 HP SimplePass are not the same program.  Do not try to install series 6 HP SimplePass on a computer on which you have already installed the 8 HP SimplePass series.  While it is true that we can term series 6 HP SimplePass on your laptop, you cannot have the two programs on the system at the same time.  They are not compatible - they were written by different programmers - they were written by competing companies - programs do not like each other.
    • Remember that series 8 has no 'fix' option for the 6 series mentioned in the Guide.  You need to reinstall the HP SimplePass software (available in the Guide, or in your case, Don, site Web on your computer supports pages).
    • For best results, do not skip the reboot / reboot sequences.  Windows like a good restart.  HP SimplePass really enjoys a good reboot sequence; the database is a fussy code fish.
    • If all else fails and you have tried everything and that the universe is against you - completely remove the program from the computer, perform the Hard Reset sequence - do not forget this isn't, won't erase your computer - and then, very slowly, start on the Section:

    Procedure - updated / (install HP SimplePass Re)

    • Don't forget that if you want really to CONNECT using your fingerprint, you HAVE not even fingerprints - Windows 8.1 has its own connection software native of fingerprints that will at least you connect to Windows.  You cannot use it to control the Web sites, but you can get at least on the computer by using the fingerprint reader.

    Good luck!

    You should search this forum for what other Experts say!

    Click on the Thumbs - Up Kudos to show that you appreciate the help.

    Click on accept as Solution when the answer provides a fix or a workaround!

    Although I strive to reflect best practices of HP, I do not work for HP.

  • OfficeJet 6500 wireless mode ensures no wake upward

    I have a wireless 6500 newly installed.  Once he falls asleep for a while (on the order of hours), he refuses to wake up.  The power button and not another button on front of it will bring to life, is not accessible via radio.  Only a restart of power switch it will bring back to life.

    Running Linksys WRT150n locked mode 802.11 g, WPA PSK TKIP, DHCP, uPNP disables, MAC filtered.

    Disconnected USB, DSL Frontier, filter.

    Talked to the Helpdesk for more than an hour.  Talk to the cat is about as effective as the help I received.  I was told that I should not plug the printer into a commercial surge protector; I should just plug it directly into the wall.  I learned that the power of 9 button # reset sequence.

    Any suggestions will be greatly appreciated.

    Don

    A side effect, we noticed with latest FW upgrade Apple their Airport Extreme wireless routers is that our printers is no longer a default gateway IP address.  This should only affect printers that make outbound connections to the internet, as some of our printers.

    When you set a static IP address in our printers, you need to set the (usually 255.255.255.0) subnet mask and the default gateway IP (usually IP address of your network which is the IP address of the printer with the last byte to 1).

    I don't know if it's what you see with your Officejet 6500, but affecting a static IP address does not hurt as long as the printer is still on.

  • OfficeJet Pro L7680 dropped off the grid, indicates 'No Link'

    I have been using this printer for about 3 years on my home network.   I assigned a static IP address, and the family had been printing happily.   A few weeks ago, the printer is offline and I was not able to put it back on the network.   We can print correctly by using the USB cable, but it does not help when the computer is a desktop machine in another room.

    I tried the automatic (DHCP) and manual settings on the printer, but I cannot be granted on the router, not to mention all the client computers.

    When I go into screen manual IP settings on the printer control panel, it shows 'No. Link' at the bottom.    The router not indicate any ethernet connection on the port, I have the connected printer.   Changing the port on the router has no effect, and other ports on the router are working fine (cable the computers are online).   When I look at the Ethernet on the back of the printer, I see a yellow light and a green light.  When I unplug the ethernet of the printer connector, the Green and yellow lights will remain lit.

    My theory is that there no ethernet on the printer controller.  If someone can tell me what means 'No. Link' and a green and yellow light?

    Sorry - seems bad.  You could try to reset the configuration of the network on the printer and then put cycling on the printer.

    If this does not work, then you can try a partial reset (hold it # and 3 keys while you plug in the printer and turn on).  You can also try a reset full semi (# and 6 keys) and a complete reset (# and 9 keys) as well.

    Note that you will lose all your settings with these reset sequences.

    Good luck.

  • How to create simultaneous program of type PL/SQL stored procedure?

    I have the procedure to reset sequence as below:

    CREATE OR REPLACE PROCEDURE DEV_RESET_XX IS

    V_NEXT_VAL1 NUMBER;

    BEGIN

    RUN IMMEDIATELY "ALTER SEQUENCE DEV_RECEIPT_S1 MINVALUE 0';"

    RUN IMMEDIATELY "SELECT DEV_RECEIPT_S1. DOUBLE NEXTVAL ' IN V_NEXT_VAL1;

    RUN IMMEDIATELY "ALTER SEQUENCE DEV_RECEIPT_S1 INCREMENT BY ' |" -V_NEXT_VAL1;

    RUN IMMEDIATELY "SELECT DEV_RECEIPT_S1. DOUBLE NEXTVAL ' IN V_NEXT_VAL1;

    RUN IMMEDIATELY "ALTER SEQUENCE INCREMENT DEV_RECEIPT_S1 1 ';"

    END DEV_RESET_XX;

    And if I run this query don't use PL/SQL, no problem and success.

    EXEC DEV_RESET_XX

    And then I want to create simultaneous program for this procedure.

    1. create the executable program

    -Methods: PL/SQL, stored procedure

    2. create the simultaneous program

    -Call the executable program

    -Nothing parameter

    3. assign the application group to receive

    And then I try to run this competitor.

    But, status complete error.

    8-31-2015 7-10-22 PM.jpg

    Help, please.

    Thank you.

    Hello

    To save pl sql program, we have two required parameters. ERRBUFF and RETCODE

    Steps to create a concurrent program of type PL/SQL stored procedure. Techmandate.com

    No need to create these parameters in the simultaneous program window. Just use those in your procedure.

    hope this will help you

  • OdiReinitializeSeq

    Hi Experts,

    I tried several times to OdiReinitializeSeq, it still shows with success the executions, but the sequence is not reset.

    I tried for database sequences (native sequences), created not odi sequences.

    I'm not able to understand what is problem to reset sequence

    See you soon,.
    Surya.

    >

    As my understand the document:

    This utility works for odi packed sequences only. I reason?

    Yes... you are

  • Creating primary key based on the Date

    Hi all
    I am trying to create a unique ID for each record, based on the date that the record is created. Example, if the folder is created today, I want to the key is 20101130XX where XX is a sequential list of numbers e.g. 01, 02, 03 etc... in the case where more than one person creates a record today.

    If 3 people created record yesterday their unique ID would be

    2010112900
    2010112901
    2010112902

    and then comes the midnight and someone creates a new record, that it would be

    2010113000

    This is intended to give each record with a unique ID that will be used to reference the ticket.

    We are already using the date format, but currently users have to manually enter the id and who can create errors such as 2011112900 when it should have been 2010112900 then instead of 2010 they put 2011

    I'm not sure how to create a trigger to generate this type of unique identification number and would appreciate any help

    Thanks in advance

    Wally

    Never said it was perfect, but then again, it is a rather sticky issue... Reset sequence work would be scheduled to run @ some point... You entered in tables past 24/7? I would say that system could be locked for those 5 minutes sequence is updated, or the table is locked to allow no access while the process is...

    To be honest, that is the question in the design of a key value that is dependent on outside data, as apposed to a surrogate key, which is generated System... Again, you could have at ONCE and have the surrogate for a key key REAL primary and date + sequence as a secondary key for the use of basic unit of carbon...

    Thank you

    Tony Miller
    Webster, TX

    If vegetable oil is made from vegetables, then what is baby oil?

  • Run pubs "in the clause.

    Hello world

    I try to use Execute pubs with "en" clasue in there. Here is the code that I have
    create or replace PROCEDURE test (COLUMN_NAME VARCHAR2) is
    
    VAR_VALUE NUMBER;
    
    lv_sql  varchar2(4000);
    
    begin
    --DBMS_OUTPUT.PUT_LINE()
    lv_sql := 'SELECT MAX('||':column_name'||') FROM AUTHORIZATION_X';
    DBMS_OUTPUT.PUT_LINE (lv_sql);
    execute immediate lv_sql into var_value
    using column_name;
    DBMS_OUTPUT.PUT_LINE (to_char(VAR_VALUE));
    
    end; 
    This is the simplest code that I use. I need to pass a 'name cloumn' in a table and I try to get the max value in this table and display.
    I'm getting some 'not a sql valid' error when I use the code above.

    Please correct my code is there is nothing wrong in.

    and in some documents I've seen: 1: 2:3 ratings where we need to pass parameters to the dynamic sql statements. Should it be in any order?

    Thank you
    Phani

    Marella Phani wrote:
    Hi blushadow and sean.

    Thanks for the reply...

    In fact, we do periodic refersh of the prod database for test, development environment. In this update of the test, dev environments sequences become out of sync (I think).

    Sean... Yesterday I read somewhere that "we must delete and recreate sequences if we start the sequence with the new value' '

    I'll try this coomand rather 'ALTER SEQUENCE your_seq INCREMENT BY x"and get back to you if I have a problem...

    Here is an example of reset sequences...

    {code}
    SQL > select test.nextval from double;

    NEXTVAL
    ----------
    125

    SQL > v_inc var number;
    SQL > v_resetno var number;
    SQL > exec: v_resetno: = 50;

    PL/SQL procedure successfully completed.

    SQL > exec 'select-(test.nextval-:x)-1 of the double' immediate execution in: using v_inc: v_resetno;

    PL/SQL procedure successfully completed.

    SQL > exec immediately executes ' change increment test sequence of '. : v_inc;

    PL/SQL procedure successfully completed.

    SQL > select test.nextval from double;

    NEXTVAL
    ----------
    49

    SQL > alter the test sequence increment by 1.

    Modified sequence.

    SQL > select test.nextval from double;

    NEXTVAL
    ----------
    50

    SQL > select test.nextval from double;

    NEXTVAL
    ----------
    51

    SQL >
    {code}

    Sean and blushadow... I saw using: 1: 2:3 in dynamic sql. How do I use this syntax? who should be in a particular order?
    can we use other names?

    Yes, you can as in my sample code above. The bind variable are just placeholders, so you can call it what you like. What you should remember, is that you can only bind in values, not the column names or table names.

  • How to place an order in the sccm task sequence to reset the bios on computers laptops hp

    SCCM 2007

    I'm looking for a command to run in the task sequence to reset the default bios before running the deployment of the operating system

    2540 P - laptops HP ELITEBOOK 2560p, 8460p 2570p,.

    I found the good article on this topic

    http://h20331.www2.HP.com/Hpsub/downloads/cmi_whitepaper.PDF

    pages 19-20

  • Reset oracle sequence

    Hello world

    with the help of an ETL tool I'm migrating data in oracle database tables here I do not use oracle sequence. After the migration, I have to reset the sequence.

    ex: table: employee, name of the sequence: employee_id_seq

    initially:

    create sequences employee_id_seq

    start by increment of 1 by 1;

    data in the Employee table:

    employee_id ename

    --------               ---------

    1                    aa

    5                    bb

    6                    cc

    to restore order, I drop this sequence and recreate the sequence

    IE.,.

    employee_id_seq sequence of fall;

    Max (employee_id) here is 6 nextvalue is 7.

    create sequences employee_id_seq

    starts with 7 increment of 1;

    Select double employee_id_seq.nextval;

    nextval:

    --------

    7

    instead of delete and re-create the sequence any other method is there to reset the sequence.so, I want to create a dynamic script that will reset all of the sequences.

    Please advise on this.

    Thank you

    Jery

    Hi all

    script below works fine

    CREATE OR REPLACE PROCEDURE SP_DYNAMIC_RESET_SEQ_SCRIPT

    as

    SQLSTR1 varchar (40);

    SQLSTR2 varchar (40);

    SQLSTR3 varchar (40);

    SQLSTR4 varchar (40);

    number of max_val_incol;

    number of max_val_currval;

    T1 varchar (1000);

    Q2 varchar (1000);

    T3 varchar (1000);

    Start

    for c in (select TABLE_NAME from M_ALL_DYNAMIC_DRIVER_san)

    loop

    SQLSTR1: = c.table_name; -This will store the name of the table [emp, dept]

    SQLSTR2: = upper (TRIM (SQLSTR1)) | ' _ID'.

    SQLSTR3: = upper (TRIM (SQLSTR1)) | ' _ID_SEQ';

    SQLSTR4: = SQLSTR3 |'. NEXTVAL';

    RUN IMMEDIATELY "SELECT MAX ('|)" SQLSTR2 |') OF ' | SQLSTR1 IN max_val_incol;

    Q1: = 'ALTER SEQUENCE |  SQLSTR3 | ' INCREMENT ' | max_val_incol;

    EXECUTE IMMEDIATE q1;

    eXECUTE IMMEDIATE 'SELECT'. SQLSTR4 | 'FROM DUAL"IN max_val_currval;

    Q2: = 'ALTER SEQUENCE |  SQLSTR3 | ' INCREMENT OF 1';

    EXECUTE IMMEDIATE T2;

    end loop;

    END;

    Thank you all, helped on that.

Maybe you are looking for