oralce 开发:
1,自增长序列
方法一:建表,建序列
create table mytable
(
id number primary key,
name char(14),
sex char(2) check (sex='1' or sex='0'),
mark varchar2(1000)
)
create sequence XOK_AUTOINC
minvalue 1
start with 1
increment by 1
nocache;
insert into mytable values(XOK_AUTOINC.nextval,'xxx','1','xok.la');
方法二:
建表,见序列,建触发器
create table mytable
(
id number primary key,
name char(14),
sex char(2) check (sex='1' or sex='0'),
mark varchar2(1000)
)
create sequence XOK_AUTOINC
minvalue 1
start with 1
increment by 1
nocache;
create or replace trigger INSERT_FOR_AUTOINC
before insert on mytable
for each row
begin
select XOK_AUTOINC.nextval into :new.id from dual;
end insert_for_autoinc;
insert into mytable(name,sex,mark) values('xxx','1','xok.la');
插入时间:to_date('2007-12-28 10:07:24' , 'yyyy-mm-dd hh24:mi:ss')