--insert records
insert into userlogin_his(usrname,logintime) values('test',to_timestamp(to_char(sysdate,'YYYY-MM-DD HH24:MI:SS'),'YYYY-MM-DD HH24:MI:SS'));
insert into userlogin_his(usrname,logintime) values('test1',to_timestamp(to_char(systimestamp,'YYYY-MM-DD HH24:MI:SS.FF'),'YYYY-MM-DD HH24:MI:SS.FF'));
insert into userlogin_his(usrname,logintime) values('test2',systimestamp);
insert into userlogin_his(usrname,logintime) values('test3',sysdate);
--query records
select usrname,to_char(logintime,'YYYY-MM-DD HH24:MI:SS.FF') from userlogin_his;
USRNAME TO_CHAR(LOGINTIME,'YYYY-MM-DDHH24:MI:SS.FF')
test 2017-03-30 18:09:59.000000
test1 2017-03-30 18:13:27.505000
test2 2017-03-30 18:28:16.521000
test3 2017-03-30 18:29:48.000000
从以上语句和执行结果来看,第4行代码是最简洁明了的。推荐采用。