Answers for "loop pl/sql"

SQL
1

sql for loop

DECLARE
	n NUMBER(2);
BEGIN
	FOR n IN 10 .. 15 LOOP
    	dbms_output.put_line('n= ' || n);
    END LOOP;
END;

# When executed the output should be...
n= 10
n= 11
n= 12
n= 13
n= 14
n= 15
Posted by: Guest on March-07-2020
0

sql for loop

/*
For loop in sql
*/
Example:
DECLARE 
   a number(2); 
BEGIN 
   FOR a in 10 .. 20 LOOP 
      dbms_output.put_line('value of a: ' || a); 
  END LOOP; 
END; 
/


Output:
value of a: 10 
value of a: 11 
value of a: 12 
value of a: 13 
value of a: 14 
value of a: 15 
value of a: 16 
value of a: 17 
value of a: 18 
value of a: 19 
value of a: 20
Posted by: Guest on May-07-2020
0

pl/sql loop example

DECLARE
  l_counter NUMBER := 0;
BEGIN
  LOOP
    l_counter := l_counter + 1;
    IF l_counter > 3 THEN
      EXIT;
    END IF;
    dbms_output.put_line( 'Inside loop: ' || l_counter )  ;
  END LOOP;
  -- control resumes here after EXIT
  dbms_output.put_line( 'After loop: ' || l_counter );
END;Code language: SQL (Structured Query Language) (sql)
Posted by: Guest on September-06-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language