I am recreating a database existing in SQL Server in Oracle. I am a novice in DDL and new to Oracle. I have come across the following table in SQL Server
CREATE TABLE [DailyCounts](
[LDate] [datetime] NOT NULL CONSTRAINT [DF_LDate] DEFAULT (getdate()),
[SourceTable] [varchar](32) NOT NULL,
[TableRowCount] [bigint] NOT NULL,
CONSTRAINT [PK_DailyCounts] PRIMARY KEY CLUSTERED
(
[LDate] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
) ON [PRIMARY]
The table stores daily row counts for each of large tables in the database about 4 tables (4 rows per day).
What is the equivalent table definition for above table in Oracle especially the equivalent for the index options in Oracle? I don't know anything about index options and if they are required in this case.
CONSTRAINT [PK_DailyCounts] PRIMARY KEY CLUSTERED
(
[LDate] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY]
) ON [PRIMARY]
I know ON PRIMARY
is not required in the above query, Oracle doesn't have clustered indexes and that Oracle creates indexes for primary keys. Thus personally I feel the following query should do the job.
CREATE TABLE DailyCounts(
LDate timestamp DEFAULT sysdate CONSTRAINT PK_DailyCounts PRIMARY KEY,
SourceTable varchar2(32) NOT NULL,
TableRowCount number(19) NOT NULL
);