oracle常用命令

1.解锁用户
alter user scott account unlock;


2.设置主键自增长


1.首先建一个sequence

create sequence test_seq start with 1 increment by 1 nocycle;

2.建一个trigger

create or replace trigger test_seq
before insert on user_test //table_name
for each row
when(new.id is null)

begin
  select test_seq.nextval
  into :new.id from dual;
end;


3.插入日期类型值

insert into table_name(date_cloumn) values(to_date('2012-9-8','yyyy-mm-dd'));

你可能感兴趣的:(oracle,sql)