I have the following ProductCategory dimension in my DWH design to not lose data :
ProductSK ProductID ProductName BI_StartDate BI_EndDate
-1 -1 Undefined 99991231 99991231
The ProductSK is an identity column.
I am used to use Turn ON/OFF Identity Insert in SQL Server, how can I do the same in Oracle?
This is my dimension DDL :
CREATE TABLE ProductCategory (
ProductSK NUMBER GENERATED ALWAYS AS IDENTITY,
ProductID NUMBER NOT NULL,
ProductName VARCHAR2(100) NOT NULL,
BI_StartDate NUMBER NOT NULL,
BI_EndDate NUMBER NOT NULL,
);
The equivalent in SQL Server :
SET IDENTITY_INSERT sometableWithIdentity ON;
SET IDENTITY_INSERT sometableWithIdentity OFF;
In SQL Server
Basically you turn on and off the possibility to insert into an identity column which is defined as a sequence of numbers based on an interval.
In Oracle, you have the option to use
IDENTITY GENERATED BY DEFAULTExample
This option allows you to either insert or not ( which is kind of turning on / off ) in a sense very similar to the SQL Server turn on/off.