Oracle Is there a way to update date and not month, year

Is there a way to update the date part of a column of type Date. For example, a row in the DB has value 2013-11-22 [stored in YYYY-MM-DD format]. And I want to update it to 2013-11-01.

If it had been one or few rows I could have done a simple update. But the real problem is that there are about hundred thousand rows with different date values. And I want to update all the dates to the 1st of each month. For example

     Actual    What I would like it to be
    2013-01-22  2013-01-01
    1989-10-03  1989-10-01
    2004-07-01  2004-07-01
    2005-12-31  2005-12-01

Would appreciate any help, how can i get this done through SQL. Thanks in Advance.

Answers


Assuming that the data type is a date, use trunc

TRUNC(date_column, 'mm')

Here is a sqlfiddle demo


Need Your Help

How can I overlap an element in the middle of 2 different columns?

html css twitter-bootstrap

I'm making a homepage right now, with a colored background as my section background, a background image as my 'about-left' div, which is located on the left half of this section, and content info o...

Chaining properties in C# & unexpected results

c# .net properties struct value-type

I was just having a quick read through this article (specifically the bit about why he chose to use structs / fields instead of classes / properties) and saw this line:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.