Forum Stats

  • 3,752,196 Users
  • 2,250,468 Discussions
  • 7,867,747 Comments

Discussions

Generate 12c Identity clause

mmagan-Oracle
mmagan-Oracle Member Posts: 30 Employee

Jeff's blog post describes how to generate an identity column. This procedure generates a DDL statement like:

CREATE TABLE table_name (
    id                 NUMBER(18)
       GENERATED BY DEFAULT
       AS IDENTITY

This structure does not allow a null to be included in the insert statement. However, some applications do issue INSERT statements with the ID column.

The solution (as explained here) is to generate the DDL with the 'ON NULL' as:

GENERATED BY DEFAULT ON NULL
AS IDENTITY

Question: How do I do this in SQL Developer Data Modeler?

PS: In an earlier version of this post, I indicated that APEX applications run into this problem. I since learned that, APEX allows you to set a "Query Only" switch on the ID column that prevents this problem.

Saubhik

Answers