--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');