Thursday, July 3, 2008

Date in oracle

How to update the date column of the table?
If column is date type
UPDATE TableName SET Updateable_Col =to_date('yourDate’,'MM/DD/YYYY') WHERE ColumnName ='Paramenter'.

or if column is string type
UPDATE TableName SET Updateable_Col =to_char('yourDate’,'MM/DD/YYYY') WHERE ColumnName ='Paramenter'.

Note:
1. To_date(‘Column Parameter’, ‘Date Format’) function converts a string to a Date.
2. To_Char(‘Column Parameter’, ‘Date Format’) function converts a Date to a String.

SnoField NameUsed for
1TableNameTable name, which table you want to update.
2Updateable_ColColumn Name, which column you want to update
3YourDateDate as 06/25/2008
3ColumnNameIn respect to which column you want to update


0 comments: