Oracle时间精确到时、分、秒处理方法
一般数据库中时间的格式为DATE类型,而我们从页面中获取的时间往往为String类型,这个就需要类型的转换。一般我们会通过调用 Java.text.SimpleDateFormat JAVA类来对其进行转换。这个JAVA类中我们经常用到的方法有两个,一个是format(将时间格式的数据转换成String类型),另一个就是 parse(将String类型转换成DATE类型)。我们一般可以将parse封装到自己的方法中,例:
/**
* 方法描述:页面中字符串转化为日期类型
*
* 输入参数:从页面中得到的以字符串形式表示的日期数据
* 输出参数:转换后的日期
*/
Public class TimeExh{
public static Date transToDate(String strDatefromPage) {
Date date = null;
//此处为yyyy-MM-dd 则为2005-1-13
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//建立一个一定格式的 SimpleDateFormat
if(strDatefromPage==null) {
return new Date();
}
if (strDatefromPage.length()>10) {
sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
//此处时间方式为2005-1-13 20:00:12
}
try {
date = sdf.parse(strDatefromPage);
} catch (Exception ex) {
ex.printStackTrace();
}
return date;
}
}
在Oracle数据库中提供了to_date的方法来对String类型的时间来进行转换。而在Oracle数据库中不能将时间直接放到VO中传给数据库,这样数据库中的时间为格林氏时间,不符合中国人的时间习惯。所以在这里有两中不同的处理方式进行处理。
第一种:VO中存储时间的类型为String类型。
我在这里写一个简单的VO为:
public class DateVO {
..........//省略掉定义部分
public void setStart_Date(String Start_Date){
start_Date= start_Date
}
相关文档:
一、语法
大致写法:select * from some_table [where 条件1] connect by [条件2] start with [条件3];
其中 connect by 与 start with 语句摆放的先后顺序不影响查询的结果,[where 条件1]可以不需要。
[where 条件1]、[条件2]、[条件3]各自作用的范围都不相同:
[where 条件1]是在根据“connect by [条件2] ......
1.
概念不同:
连接是指物理的客
户端到oracle服务端的连接。一般是通过一个网络的连接。
在已建立的连接
上,建立客户端与oracle
的会话,以后客
户端与oracle
的交互都在一个会话环境中
进行。
2.
关系是多对多:[同意网友的意见,应该是1对
多。一个会话要么 ......
pl/sql 表
在pl/sql块中临时使用、像数组一样的对象
包含一列和一个主键
不能对列和主键进行命名
列可以是任何标量数据类型
主键必须是binary_integer类型
大小没有限制
声明pl/sql表
定义表的类型
type 类型名 is table of 列类型|变量数据类型 ......
这篇文章阐述了如何管理oracle ERP的interface表
这篇文章阐述了如何管理oracle ERP的interface表
http://blog.oraclecontractors.com/?p=212
There are a number of tables used by Oracle Applications that should have no rows in them when all is running well, and if any, only a few rows that are in error. ......