Print Thread
Named check constraints
#63905 05/08/22 09:44 PM
Joined: Aug 2003
Posts: 63
V
vllr Offline OP
Member
OP Offline
Member
V
Joined: Aug 2003
Posts: 63
Guys,

is there any way to keep named not null check constraints in original style when DDL is generated? Example:
This is original DDL script for table creation:
Code
create table TEST_CONS
(
  col1        VARCHAR2(10) constraint CK_col1_not_null not null,
  col2        VARCHAR2(10),
  col3        VARCHAR2(10) constraint CK_col3_not_null not null
);
If we create DDL for this table from PLSQL developer, it looks like this:
Code
create table TEST_CONS
(
  col1 VARCHAR2(10),
  col2 VARCHAR2(10),
  col3 VARCHAR2(10)
);
-- Create/Recreate check constraints 
alter table TEST_CONS
  add constraint CK_COL3_NOT_NULL
  check ("COL3" IS NOT NULL);
alter table TEST_CONS
  add constraint CK_COL1_NOT_NULL
  check ("COL1" IS NOT NULL);
Though from DB perspective they work in the same way, there is some difference from dictionary perspective - in the first case column is shown as "not nullable" in dba_tab_cols, while in the second - it is "nullable". This leads to some problems with automatic code generators that are using info from dba_tab_cols view.

Thank you!!!

Re: Named check constraints
vllr #63909 05/09/22 09:11 AM
Joined: Aug 1999
Posts: 22,198
Member
Offline
Member
Joined: Aug 1999
Posts: 22,198
I have added this to the list of enhancement requests.


Marco Kalter
Allround Automations

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.069s Queries: 16 (0.030s) Memory: 2.4974 MB (Peak: 3.0380 MB) Data Comp: Off Server Time: 2024-04-19 06:05:43 UTC
Valid HTML 5 and Valid CSS