반응형
오라클 테이블 생성 ( not null enable )
테이블 생성 시 not null enable 이라고 되어 있는것이 있다.
not null 이면 not null 이지 enable 은 뭔가?
아래 예제를 살펴보자
SQL> CREATE TABLE T1 (USER_NO VARCHAR2(14 BYTE) not null enable);
Table created.
SQL> CREATE TABLE T2 (USER_NO VARCHAR2(14 BYTE) not null disable);
Table created.
SQL> select table_name, constraint_name, constraint_type, status
2 from user_constraints;
TABLE_NAME CONSTRAINT_NAME C STATUS
------------------------------ ------------------------------ - --------
T1 SYS_C007492 C ENABLED
T2 SYS_C007493 C DISABLED
SQL> insert into T1 (USER_NO) values (null);
insert into T1 (USER_NO) values (null)
*
ERROR at line 1:
ORA-01400: cannot insert NULL into ("SCOTT"."T1"."USER_NO")
( NULL 을 삽입할 수 없습니다. )
SQL> insert into T2 (USER_NO) values (null);
1 row created.
SQL> commit;
Commit complete.
NOT NULL ENABLE : NULL 값 입력 불가
NOT NULL DISABLE : NULL 값 입력 가능
결국 NOT NULL 만 써도 ENABLE 은 기본값인 것을 알 수 있다.
반응형
'IT > Oracle' 카테고리의 다른 글
| 오라클 drop 된 테이블 복원 ( Flashback ) Recycle Bin 이란 무엇인가 (0) | 2017.06.21 |
|---|---|
| 오라클 SQL 튜닝 by Nested Loops Join (0) | 2017.06.20 |
| 테이블 logging 옵션 10초만에 변경! (1) | 2017.05.31 |
| DBA_HIST 를 활용하여 설정분석 (0) | 2017.05.30 |
| tnsnames.ora 파일 어디에 있을까! (6) | 2017.05.26 |