ORACLE常见操作

--oracle建表
drop table work_order;

CREATE TABLE work_order(
  id number(11) primary key,
  csdm number(30),
  user_id number(11),
  gdlx number(1),
  sf_xf number(1),
  xxqk varchar2(255),
  insert_time date,
  update_time date,
  is_delete number(1)
);

comment on table work_order is '工单表';
comment on column work_order.id is 'id';
comment on column work_order.csdm is 'CSDM';
comment on column work_order.user_id is '用户表id';
comment on column work_order.gdlx is '工单类型:0: \"功能异常\", 1: \"使用建议\"';
comment on column work_order.sf_xf is '是否修复';
comment on column work_order.xxqk is '详细情况说明';
comment on column work_order.insert_time is '提交工单时间';
comment on column work_order.update_time is '更新时间';
comment on column work_order.is_delete is '是否已删除';

--实现主键自增
--第一步:创建序列:
create sequence userID_seq 
  minvalue 1           --最小值限制为1
  maxvalue 9999   --最大值限制
  increment by 1      --每次自增1
  start with 1;           --从1开始计数
  
  
--第二步:创建立触发器:
create or replace trigger userID_tri
  before insert on t_zdry_user
  for each row
  begin 
  select userID_seq.Nextval into :new.id from dual;
  end ;

--新增字段和注解 
alter table gxdw add departfullcode VARCHAR2(100);
comment on column gxdw.departfullcode is '部门全码';

--删除字段
alter table gxdw DROP COLUMN departfullcode

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值