PL/SQL (MOSC)

MOSC Banner

using dbms_lock.sleep() Sleep in a pl / sql block

edited Nov 16, 2009 9:35PM in PL/SQL (MOSC) 12 commentsAnswered
I have this simple pl / sql block

set serveroutput on
set timing on
declare
  cursor kam is
    select upper(state_cd) st from zip_codes_us;
begin
   for i in kam loop
    dbms_output.put_line(i.st||' STATE');
    --dbms_lock.sleep(1);
   end loop;
end;
/

I saved this as test.sql and when I run this from sql plus using @test.sql, I get the following output

AK STATE
AL STATE
AR STATE
AR STATE
AZ STATE..... and so on

Now we need to put a pause / sleep after each state is displayed....
for example, display first record, i.e. AK STATE, then pause for 1 minute and then move on to display second record, i.e. "AL STATE" and then pause for 1 minute and so on

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