Ishdan maqsad: Ma’lumotlar bazasining infologik va mantiqiy modelini, er diagrammalarini yaratishni o‘rganish. Topshiriqlar


END LOOP; DBMS_OUTPUT.PUT_LINE(‘Tamom!’)


Download 1.49 Mb.
bet45/57
Sana27.01.2023
Hajmi1.49 Mb.
#1132339
1   ...   41   42   43   44   45   46   47   48   ...   57
Bog'liq
2 5375303174699622638

END LOOP;
DBMS_OUTPUT.PUT_LINE(‘Tamom!’);
END;
Natija: 0 1 2 3 4 5 6 7 8 9
Tamom!
Statement processed.

WHILE sikl operatorining qo‘llanilishi


DECLARE
Son INTEGER:=0;
BEGIN
WHILE son < 10
LOOP DBMS_OUTPUT.PUT(son | |’ ’); son:=son + 1; END LOOP;
DBMS_OUTPUT.PUT_LINE(‘Tamom!’);
END;
Natija: 0 1 2 3 4 5 6 7 8 9
Tamom!
Statement processed.

FOR operatorining qo‘llanilishi


DECLARE son INTEGER:=0;
BEGIN FOR son IN 0 .. 10 LOOP
DBMS_OUTPUT.PUT(son | |’ ’);
END LOOP;
DBMS_OUTPUT.PUT_LINE(‘Sikl tugadi!’);
END;
Natija: 0 1 2 3 4 5 6 7 8 9 Sikl tugadi!
Statement processed.

IF ..ELSIF ..ELSE shartli operatorining qo‘llanilishi


PL/SQL dasturlash tilida shartli mantiqiy amal bajarishda IF operatoridan foydalaniladi.
Umumiy sintaksisi quyidagicha:
IF THEN
; ;
ELSIF THEN ; ; ELSE ;
;
END IF;
Misol.
DECLARE
Son INTEGER:=0;
BEGIN
FOR son IN 1 ..20 LOOP
IF ((son MOD 3 = 0) AND (son MOD 5 = 0))
THEN DBMS_OUTPUT.PUT(’Ikkalasiga karrali ’);
ELSIF (son MOD 3 = 0) THEN DBMS_OUTPUT.PUT(’3ga karrali
);
ELSIF (son MOD 5 = 0) THEN DBMS_OUTPUT.PUT(’5ga karrali
);
ELSE DBMS_OUTPUT.PUT(son); END IF;
DBMS_OUTPUT.PUT (‘ ’); END LOOP;
DBMS_OUTPUT.PUT_LINE(‘’); END;
Natija:
1 2 3ga karrali 4 5ga karrali 3ga karrali 7 8 3ga karrali 5ga karrali 11
3ga karrali 14 Ikkalasiga karrali 16 17 3ga karrali 19 5ga karrali

Download 1.49 Mb.

Do'stlaringiz bilan baham:
1   ...   41   42   43   44   45   46   47   48   ...   57




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling