Available in Oracle

xiaoxiao2021-03-06  124

Create a sequence:

CREATE SEQUENCE EXAMPLE_SEQ

INCREMENT BY 1

START WITH 1

Minvalue 1

Cache 20;

Create a trigger on an Example table

Create or Replace Trigger "Portal" .tri_example_table before INSERT ON EXAMPLE_TABLE for Each Row

Begin

SELECT EXAMPLE_SEQ.NEXTVAL INTO: New.example_id from DUAL

END;

If the system is not huge, then create a sequence, but you need to create multiple triggers for multiple tables to generate the water jigra.

转载请注明原文地址:https://www.9cbs.com/read-99262.html

New Post(0)