oracle修改变列字段,oracle基本操作,Oracle修改列名,Oracle修改字段类型

oracle基本操作,Oracle修改列名,Oracle修改字段类型

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

©Copyright蕃薯耀 2017年3月16日

http://fanshuyao.iteye.com/

--修改列名

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://fanshuyao.iteye.com/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值