Created
May 4, 2023 11:18
-
-
Save xtender/7abcece59647e789322e742a6454b139 to your computer and use it in GitHub Desktop.
timestamp/localtimestamp
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 to_char(systimestamp,'dd.mm.yyyy hh24:mi:ss.ff6') from dual | |
2 union all | |
3 select to_char(count(*)) from dba_objects,dba_tables | |
4 union all | |
5 select to_char(localtimestamp,'dd.mm.yyyy hh24:mi:ss.ff6') from dual | |
6 / | |
TO_CHAR(SYSTIMESTAMP,'DD.MM.YYYYHH24:MI: | |
---------------------------------------- | |
04.05.2023 11:13:14.432061 | |
162109205 | |
04.05.2023 11:13:14.432063 | |
3 rows selected. | |
SQL_ID: ah467w767g3ph | |
Elapsed: 00:00:14.35 | |
SQL> promp &_SQL_ID | |
ah467w767g3ph | |
SQL> def SQLID='&_SQL_ID' | |
SQL> set timing off feed off; | |
SQL> select elapsed_time,cpu_time from v$sql where sql_id='&SQLID'; | |
ELAPSED_TIME CPU_TIME | |
------------ ---------- | |
14290103 14287703 | |
SQL> set echo off feed on; |
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> with | |
2 function f_timestamp return timestamp as | |
3 begin | |
4 return systimestamp; | |
5 end; | |
6 select to_char(f_timestamp,'dd.mm.yyyy hh24:mi:ss.ff6') from dual | |
7 union all | |
8 select to_char(count(*)) from dba_objects,dba_tables | |
9 union all | |
10 select to_char(f_timestamp,'dd.mm.yyyy hh24:mi:ss.ff6') from dual | |
11 / | |
TO_CHAR(F_TIMESTAMP,'DD.MM.YYYYHH24:MI:S | |
---------------------------------------- | |
04.05.2023 11:16:34.368194 | |
162109205 | |
04.05.2023 11:16:48.470962 | |
3 rows selected. | |
SQL_ID: bx2n7fvgcf30s | |
Elapsed: 00:00:14.27 | |
SQL> promp &_SQL_ID | |
bx2n7fvgcf30s | |
SQL> def SQLID='&_SQL_ID' | |
SQL> set timing off feed off; | |
SQL> select elapsed_time,cpu_time from v$sql where sql_id='&SQLID'; | |
ELAPSED_TIME CPU_TIME | |
------------ ---------- | |
14198017 14196032 |
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
set echo on timing on feed on sql_id; | |
with | |
function f_timestamp return timestamp as | |
begin | |
return systimestamp; | |
end; | |
select to_char(f_timestamp,'dd.mm.yyyy hh24:mi:ss.ff6') from dual | |
union all | |
select to_char(count(*)) from dba_objects,dba_tables | |
union all | |
select to_char(f_timestamp,'dd.mm.yyyy hh24:mi:ss.ff6') from dual | |
/ | |
promp &_SQL_ID | |
def SQLID='&_SQL_ID' | |
set timing off feed off; | |
select elapsed_time,cpu_time from v$sql where sql_id='&SQLID'; | |
set echo off feed on; |
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
set echo on timing on feedback on sql_id; | |
select to_char(systimestamp,'dd.mm.yyyy hh24:mi:ss.ff6') from dual | |
union all | |
select to_char(count(*)) from dba_objects,dba_tables | |
union all | |
select to_char(localtimestamp,'dd.mm.yyyy hh24:mi:ss.ff6') from dual | |
/ | |
promp &_SQL_ID | |
def SQLID='&_SQL_ID' | |
set timing off feed off; | |
select elapsed_time,cpu_time from v$sql where sql_id='&SQLID'; | |
set echo off feed on; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment