如何在PL / SQL中将日期格式从MM / DD / YYYY更改为YYYY-MM-DD? [英] how to change the date format from MM/DD/YYYY to YYYY-MM-DD in PL/SQL?
本文介绍了如何在PL / SQL中将日期格式从MM / DD / YYYY更改为YYYY-MM-DD?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在表格中有一个日期列,存储为 MM / DD / YYYY
格式。我必须在 YYYY-MM-DD
格式(即XSD日期格式)的另一个表格中选择并存储相同的日期。但我无法做到这一点。
我使用这个查询:
I have a date column in a table stored as MM/DD/YYYY
format. I have to select and store the same date in another table in YYYY-MM-DD
format i.e. XSD Date Format. But i am not able to do it.
I am using this query:
select to_date(date_column,'YYYY-MM-DD') from table;
但是我仍然无法做到这一点。给我错误
But still i am not able to do it. Giving me error
ORA-01843:不是有效月份
ORA-01843 : not a valid month
请尽快回复我。
谢谢
推荐答案
使用
select to_char(date_column,'YYYY-MM-DD') from table;
这篇关于如何在PL / SQL中将日期格式从MM / DD / YYYY更改为YYYY-MM-DD?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文