java 向oracle timestamp类型字段插入毫秒级的timestamp数据

1.String类型的毫秒级日期字符串
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
Date date = null;
Timestamp st = null;
date = df.parse("2020-05-24 22:22:54:423");
st = new java.sql.Timestamp(date.getTime());

//从数据库取出毫秒级字段()
to_char(t.CCOLLECTIONTIME,'yyyy-mm-dd hh24:mi:ss.ff3')
2.向空间坐标系插入数据的例子
insert into monitor_point_geometry(pointcode,geometry)
values ('630011326050',
MDSYS.SDO_GEOMETRY(2003,8307,NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),、MDSYS.SDO_ORDINATE_ARRAY(112.98097, 28.21696)));		
3.分页查询例子
//查询10-20条数据
SELECT * FROM 
	(SELECT 
		ROWNUM AS rowno, 
		t.* 
	FROM 
		table_name t 
	where ROWNUM <= 20) table_alias 
 WHERE 
 	table_alias.rowno >= 10;
4.left join 1对n的情况取其中一条
select 
      t.ccollectionagencies ,
      ats.bikenumber,
      ats.company 
from 
      table_name t 
left join 
     (select 
           MAX(inputtime) AS REPORTTIME,
           company,bikenumber 
     from 
           left_table_name 
     group by 
           bikenumber,company) ats 
on  
     ats.bikenumber = t.ccarnumber
     ```

你可能感兴趣的:(oracle)