Home > front end >  What is the difference between LOCALTIMESTAMP vs SYSTIMESTAMP in Oracle?
What is the difference between LOCALTIMESTAMP vs SYSTIMESTAMP in Oracle?

Time:07-05

As far as I understand SYSTIMESTAMP in oracle returns server's timestamp.But what is the use of LOCALTIMESTAMP in oracle?

CodePudding user response:

Imagine you have a SQL server in NYC and you are querying from your application server in London

If you do select SYSTIMESTAMP, you'll get the timestamp from the database server in NYC including the timzeone

If you do select of LOCALTIMESTAMP you'll get the timestamp from your server making the request in London, including the different timezone.

If your server is in the same timezone as the system that's making the request there is no difference.

CodePudding user response:

LOCALTIMESTAMP returns the time in your current session time zone. This can be different to the database server time zone.

The session time zone in individual for each session and you can change it at any time by yourself.

SYSTIMESTAMP returns the time in the database server operating system time zone. Typically as a database user, you cannot change it and it applies for all user.

  • Related