oracle基本操作,Oracle修改列名,Oracle修改字段类型
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
©Copyright 蕃薯耀 2017年3月16日
http://www.cnblogs.com/fanshuyao/
- --修改列名
- alter table "KFAPP"."H_USERS" rename column "STATUS" to "new_column"
- --新增列
- alter table h_users
- add (column_name nvarchar2(1) default '1' not null);
- eg:
- alter table h_users
- add (delete_type nvarchar2(1) default '1' not null);
- --删除列
- 1、alter table h_users drop column my_type;
- 2、alter table table_name drop (column_name);
- eg:
- alter table h_users drop (deleteType);
- alter table "H_USERS" drop column "DELETE_TYPE"
- --修改列类型
- alter table tablename modify
- (column_name colomn_type [default value][null/not null]);
- eg:
- alter table h_users modify
- (my_type int default 1);
- -- 查询锁表情况
- select s.SID,s.SERIAL# from v$locked_object a ,dba_objects b ,v$session s
- where a.OBJECT_ID=b.OBJECT_ID and a.SESSION_ID=s.SID
- -- 干掉锁表进程
- alter system kill session '852,28988';
- -- 表H_USERS,自增长字段USER_ID
- -- 创建序列
- create sequence H_USERS_ID_SEQ
- start with 1
- increment by 1
- nomaxvalue
- minvalue 1
- nocycle
- cache 10;
- -- 创建触发器
- create trigger H_USERS_ID_TRG
- before insert on H_USERS for each row
- begin
- select H_USERS_ID_SEQ.nextval into:new.USER_ID from dual;
- end;
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
©Copyright 蕃薯耀 2017年3月16日
http://www.cnblogs.com/fanshuyao/