-
-
Save anonymous/7b6c4ab1bfb8abff40e8 to your computer and use it in GitHub Desktop.
time_zone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQL> select sessiontimezone from dual; | |
SESSIONTIMEZONE | |
--------------------------------------------------------------------------- | |
+04:00 | |
1 row selected. | |
SQL> declare | |
2 tstart TIMESTAMP; | |
3 tstop TIMESTAMP; | |
4 tdelta INTERVAL DAY TO SECOND; | |
5 tdelta2 INTERVAL DAY TO SECOND; | |
6 begin | |
7 tstart := systimestamp; | |
8 dbms_output.put_line('Start: ' || to_char(systimestamp)); | |
9 dbms_output.put_line('Sleeping'); | |
10 dbms_lock.sleep(1.5); | |
11 tstop := systimestamp; | |
12 | |
13 dbms_output.put_line('using current systimestamp: ' ||to_char(systimestamp - tstart)); | |
14 dbms_output.put_line('using two variables: ' ||to_char(tstop - tstart)); | |
15 end; | |
16 / | |
Start: 2014-06-11 23:56:50.168000000 +04:00 | |
Sleeping | |
using current systimestamp: +000000000 00:00:01.500000000 | |
using two variables: +000000000 00:00:01.500000000 | |
PL/SQL procedure successfully completed. | |
SQL> alter session set time_zone='+03:00' | |
2 / | |
Session altered. | |
SQL> declare | |
2 tstart TIMESTAMP; | |
3 tstop TIMESTAMP; | |
4 tdelta INTERVAL DAY TO SECOND; | |
5 tdelta2 INTERVAL DAY TO SECOND; | |
6 begin | |
7 tstart := systimestamp; | |
8 dbms_output.put_line('Start: ' || to_char(systimestamp)); | |
9 dbms_output.put_line('Sleeping'); | |
10 dbms_lock.sleep(1.5); | |
11 tstop := systimestamp; | |
12 | |
13 dbms_output.put_line('using current systimestamp: ' ||to_char(systimestamp - tstart)); | |
14 dbms_output.put_line('using two variables: ' ||to_char(tstop - tstart)); | |
15 end; | |
16 / | |
Start: 2014-06-11 23:56:51.671000000 +04:00 | |
Sleeping | |
using current systimestamp: -000000000 00:59:58.500000000 | |
using two variables: +000000000 00:00:01.500000000 | |
PL/SQL procedure successfully completed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment