请教呀,很急的毫秒时间问题! select to_char(sysdate,'yyyymmdd-hh24mi-ssss') from dual 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 [Q]怎么样从数据库中获得毫秒[A]9i以上版本,有一个timestamp类型获得毫秒,如SQL>select to_char(systimestamp,'yyyy-mm-dd hh24:mi:ssxff') time1, to_char(current_timestamp) time2 from dual;TIME1 TIME2----------------------------- ----------------------------------------------------------------2003-10-24 10:48:45.656000 24-OCT-03 10.48.45.656000 AM +08:00可以看到,毫秒在to_char中对应的是FF。8i以上版本可以创建一个如下的java函数SQL>create or replace and compile java sourcenamed "MyTimestamp"asimport java.lang.String;import java.sql.Timestamp;public class MyTimestamp{public static String getTimestamp(){return(new Timestamp(System.currentTimeMillis())).toString();}};SQL>java created.注:注意java的语法,注意大小写SQL>create or replace function my_timestamp return varchar2as language javaname 'MyTimestamp.getTimestamp() return java.lang.String';/SQL>function created.SQL>select my_timestamp,to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') ORACLE_TIME from dual;MY_TIMESTAMP ORACLE_TIME------------------------ -------------------2003-03-17 19:15:59.688 2003-03-17 19:15:59 如果只想获得1/100秒(hsecs),还可以利用dbms_utility.get_time 有关oracle的更新语句,求教!在线等 plsql developer中 查看索引窗口中索引的type是normal和unique有什么区别? pl sql保存为csv格式为什么是乱码 关于数据库中date类型 触发器的问题 请大家帮忙!刚学ORACLE10g,如何打开自带的表 请教一个SQL语句该如何写 这个sql问题如何写 数据库创建向导问题( 提示输入 SYS和SYSTEM 密码,当是没有 确定按钮) 求助:ORA-03113:通信通道的文件结尾 请问ORACLE 9i可以在WIN200Pro下安装吗? oracle server删除不当,无法安装client
[Q]怎么样从数据库中获得毫秒
[A]9i以上版本,有一个timestamp类型获得毫秒,如
SQL>select to_char(systimestamp,'yyyy-mm-dd hh24:mi:ssxff') time1,
to_char(current_timestamp) time2 from dual;TIME1 TIME2
----------------------------- ----------------------------------------------------------------
2003-10-24 10:48:45.656000 24-OCT-03 10.48.45.656000 AM +08:00
可以看到,毫秒在to_char中对应的是FF。
8i以上版本可以创建一个如下的java函数
SQL>create or replace and compile
java source
named "MyTimestamp"
as
import java.lang.String;
import java.sql.Timestamp;public class MyTimestamp
{
public static String getTimestamp()
{
return(new Timestamp(System.currentTimeMillis())).toString();
}
};
SQL>java created.
注:注意java的语法,注意大小写
SQL>create or replace function my_timestamp return varchar2
as language java
name 'MyTimestamp.getTimestamp() return java.lang.String';
/
SQL>function created.
SQL>select my_timestamp,to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') ORACLE_TIME from dual;
MY_TIMESTAMP ORACLE_TIME
------------------------ -------------------
2003-03-17 19:15:59.688 2003-03-17 19:15:59
如果只想获得1/100秒(hsecs),还可以利用dbms_utility.get_time