关于oracle中转变日期格式的问题

来源:百度知道 编辑:UC知道 时间:2024/05/15 10:32:08
现在发现有很多数据的日期格式为“20-7月 -06” 有没有办法通过语句批量修改成“2006-07-20 00:00:00” (不光是20-7月 -06,有很多日期)

不知道

需要看你这个表的"日期"字段是否是date数据类型,如果是date类型就非常简单,
修改你的$ORACLE_HOME/sqlplus/admin/glogin.sql 加上一行即可:
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

如果你的"日期"字段是char或varchar,稍微麻烦一些,需要停业务:
create table <new table>
as
select to_date(<your date column>,'dd-mon-yy'),<other columns> from <old table>;

drop table <old table>;
rename <new table> to <old table>;