如何禁止非空约束?

[复制链接]
查看11 | 回复5 | 2006-9-4 01:02:51 | 显示全部楼层 |阅读模式
不是更改为可空?
谢谢
回复

使用道具 举报

千问 | 2006-9-4 01:02:51 | 显示全部楼层
alter table x disable constraint xxx
回复

使用道具 举报

千问 | 2006-9-4 01:02:51 | 显示全部楼层
alter table tab_name modify (col_name null):
回复

使用道具 举报

千问 | 2006-9-4 01:02:51 | 显示全部楼层
楼上写错了,呵呵
人家的是让禁止约束,不是让改变哟!
回复

使用道具 举报

千问 | 2006-9-4 01:02:51 | 显示全部楼层
2楼正解
回复

使用道具 举报

千问 | 2006-9-4 01:02:51 | 显示全部楼层
SQL>create table ttt (a number not null);
Table created.
SQL> select * from user_constraints
2where TABLE_NAME='TTT';
OWNER
CONSTRAINT_NAME
C TABLE_NAME
SEARCH_CONDITION

------------------------------ ------------------------------ - ------------------------------ -------------------------------------------
SYS
SYS_C005540
C TTT
"A" IS NOT NULL

SQL> insert into ttt values(1);
1 row created.
SQL>insert into ttt values(null);
insert into ttt values(null)

*
ERROR at line 1:
ORA-01400: cannot insert NULL into ("SYS"."TTT"."A&quot


SQL> alter table ttt disable constraint SYS_C005540;
Table altered.
SQL> insert into ttt values(null);
1 row created.
SQL> select * from ttt;
A
----------
1
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行