Document Type | Technical Information
Category | Monitoring/Inspection
Applicable Product Version | Tibero7.2.4
Document Number | TMOTI051
Overview
The loop function, one of the tbSQL utility commands, is a feature that repeatedly executes a single SQL command indefinitely and has been available since Tibero6.
This function automatically repeats the previously executed SQL, with the default repeat interval set to 1 second. You can also change the desired repeat interval using the set interval command.
It is mainly useful for real-time monitoring of changes in session status or memory usage.
Method
1. Interval 1 Second
SQL> alter session set nls_datE_format='yyyy/mm/dd hh24:mi:ss'; Session altered. SQL> select sysdate from dual; SYSDATE ---------------------------------------------------------------- 2025/12/03 09:51:15 1 row selected. -- Execute the loop statement SQL> loop / SYSDATE ---------------------------------------------------------------- 2025/12/03 09:51:24 1 row selected. SYSDATE ---------------------------------------------------------------- 2025/12/03 09:51:25 1 row selected. SYSDATE ---------------------------------------------------------------- 2025/12/03 09:51:26 1 row selected. SYSDATE ---------------------------------------------------------------- 2025/12/03 09:51:27 1 row selected.
2. Interval 3 Seconds
SQL> alter session set nls_datE_format='yyyy/mm/dd hh24:mi:ss'; Session altered. -- Change the interval to 3 seconds SQL> set interval 3 SQL> select sysdate from dual; SYSDATE ---------------------------------------------------------------- 2025/12/03 09:54:14 1 row selected. SQL> loop / SYSDATE ---------------------------------------------------------------- 2025/12/03 09:54:17 1 row selected. SYSDATE ---------------------------------------------------------------- 2025/12/03 09:54:20 1 row selected. SYSDATE ---------------------------------------------------------------- 2025/12/03 09:54:23 1 row selected.