--alter table myTAB modify myfield not null novalidate;

来源:互联网 发布:unity3d ios 录屏处理 编辑:程序博客网 时间:2024/04/29 23:02
--alter table myTAB modify myfield not null novalidate;
--创建表

declare
  tm_i integer;        
begin
  select count(*) into tm_i from user_tables where lower(table_name)=lower('aaa');  
  if tm_i>0 then  
    execute immediate 'drop table  aaa ';    
  end if;
end;
/
 create table aaa as select * from scott.dept where 1=2;
/
begin 
  insert into aaa select * from scott.dept where deptno=10;
  insert into aaa select * from scott.dept where deptno=10;
  commit;
end;
/
-- select * from aaa;

--添加字段 
 alter table aaa add cc varchar2(2);
 
--修改添加字段 默认值为 '0' 非空
 alter table aaa modify cc default '0' not null  novalidate;

 
 insert into aaa (deptno,dname,loc) values (10,'name','local');
0 0
原创粉丝点击