Statement di controllo e di iterazione

This commit is contained in:
Fabio Scotto di Santolo
2019-09-11 22:52:25 +02:00
parent 6a846296a9
commit dbf7aa62ef
7 changed files with 203 additions and 0 deletions

28
LOOP.sql Normal file
View File

@@ -0,0 +1,28 @@
DECLARE
V_CODFID VARCHAR2(20) := :CODFID;
V_NUMSPESE BINARY_INTEGER := 0;
V_CONTATORE BINARY_INTEGER := 0;
V_NUMMINSPESE NUMBER := 15;
BEGIN
SELECT
COUNT(*)
INTO
V_NUMSPESE
FROM
CORSOPLSQL.SCONTRINI
WHERE
CODFID = V_CODFID;
-- Espressione LOOP
-- Si comporta simile all'istruzione do...while
IF V_NUMSPESE > V_NUMMINSPESE THEN
LOOP
V_CONTATORE := V_CONTATORE + 1;
DBMS_OUTPUT.PUT_LINE('Creato Bonus ' || V_CONTATORE);
EXIT WHEN V_CONTATORE = V_NUMSPESE - V_NUMMINSPESE;
END LOOP;
END IF;
DBMS_OUTPUT.PUT_LINE('Fatto!');
END;