can we insert date into varchar2 in oracle without converting by to_char?
Oracle will convert the date into a string using what localization settings are in place during the insert. This is true not only of Oracle but of any database. For a date, that might commonly be in the format "DD-MON-YY".
Here is an example of inserting a date into a varchar2
column.
That said, you should not do this. You should be storing date/time values in the database using the correct data type -- and that would be either date
or timestamp
. If you want to insert a constant, then use the date
or timestamp
qualifier with the appropriate value following it.