Search notes:

Oracle: Force an SQL statement to run for a given amount of time

For testing purposes, it is sometimes desired to have an SQL statement that executes for a given amount of time.
The following statement runs for 5 seconds and a bit:
select max(null) from (
    with n as (select /*+ materialize */ dbms_utility.get_time ow  from dual)
    select
       null
    from
       n connect by n.ow + 500 > dbms_utility.get_time
);
Beware that this statement might throw ORA-30009: Not enough memory for CONNECT BY operation.

See also

Using sysdate in an SQL statement.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759414056, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/SQL/statement/execution/force-duration(49): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78