Print out value using DBMS_OUTPUT.PUT_LINE : DBMS_OUTPUT « PL SQL « Oracle PL / SQL






Print out value using DBMS_OUTPUT.PUT_LINE

SQL>
SQL> --Basic loop
SQL>
SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
  2    x NUMBER := 1;
  3  BEGIN
  4    LOOP
  5      DBMS_OUTPUT.PUT_LINE('This loop has executed'||TO_CHAR(x)||' time(s)');
  6      x := x +1;
  7      EXIT WHEN x > 5;
  8    END LOOP;
  9  END;
 10
 11
 12  /
This loop has executed1 time(s)
This loop has executed2 time(s)
This loop has executed3 time(s)
This loop has executed4 time(s)
This loop has executed5 time(s)

PL/SQL procedure successfully completed.


           
       








Related examples in the same category

1.DBMS_OUTPUT package
2.Use dbms_output.put_line to display varchar2 type value
3.Concatenate string and number