创建表:
create table Dir_Member_Level
(
id INTEGER not null,
create_time TIMESTAMP default SYSDATE,
update_time TIMESTAMP,
state SMALLINT,
name VARCHAR2(100),
remark VARCHAR2(200),
constraint PK_DIR_MEMBER_LEVEL primary key (id)
);
删除表:
drop table Dir_Member_Level cascade constraints;
插入语句:
insert into dir_member_level (id,state,name,remark) values (1,1,'普通会员','普通会员');
修改数据:
update dir_member_level set create_time=sysdate,update_time=sysdate where id = 1;
修改表结构,给update_time增加默认系统时间
alter table dir_member_level modify update_time timestamp default sysdate;
给字段增加备注信息:
comment on column Dir_Member_Level.update_time is
'更新时间';
查询语句:
select * from dir_member_level;
oracle分页查询语句:
select * from (select rownum r,m.* from member m order by id asc)t where r>20 and r<=40;
在oralce中默认使用sysdate,毫秒时间是0,所以使用current_timestamp
select to_char(current_timestamp,'yyyy-mm-dd hh24:mi:ss.ff6') from dual;