Oracle PL/SQL Tutorial/PL SQL Operators/MOD
Версия от 13:45, 26 мая 2010; (обсуждение)
USE MOD operator in IF statement
SQL>
SQL> set serveroutput on
SQL> set echo on
SQL>
SQL> BEGIN
2 FOR v_loopcounter IN 1..6 LOOP
3 IF MOD(v_loopcounter,2) = 0 THEN
4 DBMS_OUTPUT.PUT_LINE("Loop counter is " || v_loopcounter);
5 END IF; -- End execution of statements for even counter
6 END LOOP;
7 END;
8 /
Loop counter is 2
Loop counter is 4
Loop counter is 6
PL/SQL procedure successfully completed.
SQL>
SQL>