PL/SQL (MOSC)

MOSC Banner

Loop test

edited Jul 20, 2017 5:01AM in PL/SQL (MOSC) 5 commentsAnswered

I would like to write a PL/SQL to loop the database, and to show there is no disconnection.

any idea ?

I wrote something be

set serveroutput on
set head off
set feed off
alter session set nls_date_format='DD-MON-YY HH24:Mi:SS';

DECLARE
   currenttime timestamp;
   terminal varchar2(20);
   inst_name varchar2(10);
BEGIN
    WHILE( true ) loop
select sysdate ,sys_context ('userenv','TERMINAL'),sys_context ('userenv','INSTANCE_NAME') into currenttime,terminal,inst_name  from dual;
DBMS_OUTPUT.PUT_LINE('Current time: ' || currenttime || ' from Terminal ' || terminal || ' to Instance: ' || inst_name);
dbms_lock.sleep(2);
END LOOP;
END;
/

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center