2

When I create table with columns not null, Oracle automatically creating check constraints to be not null: like this ( query from user_constraints view)

NAME                           TYPE SEARCH_CONDITION
------------------------------ ---- ---------------------------------------
SYS_C0036357                   C    "SUPPLIER_ID" IS NOT NULL
SYS_C0036358                   C    "SUPPLIER_NAME" IS NOT NULL

So, is there any way to know that constraint created by Oracle(Auto) or it had been created by user.

thank you.

RustamIS
  • 697
  • 8
  • 24

1 Answers1

7

You can look at the GENERATED field in the user_constraints table (or all_constraints).

create table t (a number not null, constraint t_pk primary key(a));
select table_name, constraint_name, generated
 from user_constraints
 where table_name = 'T';

Gives:

T | CONSTRAINT. | GENERATED
----------------------------
T | SYS_C008425 | GENERATED NAME
T | T_PK        | USER NAME
Mat
  • 202,337
  • 40
  • 393
  • 406