oracle里的to_char是什么意思?请举个例子

来源:百度知道 编辑:UC知道 时间:2024/05/19 02:04:40
oracle里的to_char是什么意思?请举个例子

比如一个字段类型是date类型,那么查询出来的结果想要2009-09-09,就要
select to_char(字段名,'yyyy-mm-dd') from...
查系统时间
select to_char(sysdate,'yyyy-mm-dd') from dual

to_char可以实现其他数据类型向字符类型的转换,一般用于转换时间为字符传.格式一般为to_char(date_value,date_format)
例如:
select (to_char(enrolldate,'HH24:MI:SS'))enrolldate from student;