Do Identity Insert in Oracle table
How do you do Identity Insert in Oracle? I am one of those poor souls that work in both microsoft SQL Server and Oracle and don't have the luxury of complaining about either one.
Identity Insert is something I always have used in when designing tables in Microsoft SQL server. I won't get into the argument of why we need it or should we even use it. Rather, this article is about achieving the same.
Oracle does not have any numeric Identity Insertion capability out of the box. Well, good old Sequence can come to the rescue. Create a sequence for your table/purpose or even for all purposes. then create a trigger ON INSERT to get the next value from the sequence and update your table.
Voila, you got yourself an Identity Insert Column in oracle
Identity Insert is something I always have used in when designing tables in Microsoft SQL server. I won't get into the argument of why we need it or should we even use it. Rather, this article is about achieving the same.
Oracle does not have any numeric Identity Insertion capability out of the box. Well, good old Sequence can come to the rescue. Create a sequence for your table/purpose or even for all purposes. then create a trigger ON INSERT to get the next value from the sequence and update your table.
Voila, you got yourself an Identity Insert Column in oracle
Comments
Post a Comment