Localtimestamp or curent_timestamp for default value

oracletimestamp

In Oracle-12c I have some columns that I am converting from timestamp with time zone to timestamp with local time zone. Some of those same columns also currently have a default value of CURRENT_TIMESTAMP. Should I change the default values to use the LOCALTIMESTAMP function instead? The columns seem to populate fine if I just leave the CURRENT_TIMESTAMP default values. Is there any practical reasons or gotchas for using one over the other in this case. I have been combing the docs but can't find anything.

Best Answer

You write "I don't need the time zone information", however datatype TIMESTAMP WITH LOCAL TIME ZONE has time zone information stored.

For a TIMESTAMP WITH LOCAL TIME ZONE column I don't see any difference between CURRENT_TIMESTAMP and LOCALTIMESTAMP either of them should work in the same way.

CURRENT_TIMESTAMP returns current data and time as of datatype TIMESTAMP WITH TIME ZONE, whereas LOCALTIMESTAMP returns a LOCALTIMESTAMP value. Both of them have to be implicitly converted to a TIMESTAMP WITH LOCAL TIME ZONE datatype.