Oracle Autoincrement

AshokTechnical TipsLeave a Comment

Unlike Oracle, other less expensive and less robust databases make autoincrementing a simple task…typically a couple of clicks in some easy to understand UI. Some examples are with SQL Server, MySQL, and Access. As we know, with Oracle’s additional “flexibility” can come additional work (but this is sometimes for a legitimate reason). Approach 1 Following are the steps on how you can mimic an autoincrement in Oracle: 1) create a table 2) create a sequence 3) create a trigger 4) insert record(s) CREATE TABLE test_table ( test_id INT PRIMARY KEY, test_col varchar2(100));   CREATE SEQUENCE test_seq;   CREATE TRIGGER test_trigger … Read More