PL/SQL tutorial 12: PL/SQL WHILE Loop in Oracle Database

preview_player
Показать описание
Iterative statements/loop series learn the concepts of While Loop in PL/SQL or In Oracle Database with Examples. also learn how to handle boolean expression in while loop
------------------------------------------------------------------------
►►►LINKS◄◄◄
Previous Tutorial
-------------------------------------------------------------------------
►►►Let's Get Free Uber Cab◄◄◄
Use Referral Code UberRebellionRider and get $20 free for your first ride.

-------------------------------------------------------------------------
►Make sure you SUBSCRIBE and be the 1st one to see my videos!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
►►►Find me on Social Media◄◄◄
Follow What I am up to as it happens on

You can also Email me at
for E-mail address please check About section

Please please LIKE and SHARE my videos it makes me happy.
Thanks for liking, commenting, sharing and watching more of our videos

♥ I LOVE ALL MY VIEWERS AND SUBSCRIBERS
Рекомендации по теме
Комментарии
Автор

You can save the IF part at the end if you switch it to
V_test := (v_counter < 10);
The part inside the () is a true or false statement which will be false only when v_counter reaches or exceeds 10.

Simmlex
Автор

With simple example you explain the concept very well. thank you Sir for awesome learning

helpingustayfit
Автор

Instead of that if condition for terminate loop can we use exit when commend like
EXIT WHEN v_counter >= 10; (Boolean program)

delvenacquire
Автор

Is it can be debugged by without creating functions, proc or package?

DamaraskaArya
Автор

hi manish
my question is what is the use of boolean expression as a test condition in while loop

afiqrubiyan
Автор

sir please make video on static and dynamic sql

SM-qdvw
Автор

how to increse text size in sql developer ?

kapilchaudhary
Автор

Hi Manish,
I tried 'dbms_output.put_line' just before starting of while loop but i am getting an error. Can you help me with that why i am getting an error

sudhanshubaranwal
Автор

Hi Manish, I am executing a package.sp from shell script. How do I use SERVEROUTPUT ON for DBMS_OUTPUT.PUT_LINE?..please help

kumarkrori
Автор

Dear teacher,
I have a problem with Boolean datatype v_test variable. I get message like this "v_test" must be declared. But I have declared it already. Could you help me?

chanda_cartoon_handle
Автор

Can anyone please tell me what is this IDE abd how to download explanation btw...thanks for making such videos✌️

manishshaw
Автор

Here is what you asked for,
SET SERVEROUTPUT ON;

DECLARE
v_test BOOLEAN :=TRUE;
v_counter NUMBER :=0;
v_result NUMBER;
BEGIN
WHILE v_test LOOP
v_counter := v_counter +1;
v_result := v_counter * 19;
x '|| 19 ||' = '||v_result);
IF v_counter =10 THEN
v_test := FALSE;
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE('Outside the Loop');
END;

stephinstephen
Автор

Hi Manish,

Please find the program for multiplication table of 8 till 12.

SET SERVEROUTPUT ON;
DECLARE
v_test BOOLEAN := TRUE;
v_counter NUMBER :=0;
v_result NUMBER;
BEGIN
WHILE v_test
LOOP
v_counter := v_counter + 1;
v_result := 8 * v_counter;
DBMS_OUTPUT.PUT_LINE('8' || '*' || v_counter || '=' || v_result );

IF v_counter = 12 THEN
v_test := FALSE;
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE('DONE');
END;

shrav
Автор

SIR, I HAVE CONPLETED SQL. SIR IS IT COMPLETE SYLLEBUS FOR PLSQL FOR FRESHERS INTERVIEW ...?? PLZ SUGGEST ME SIR

maulikchaudhari
Автор

why r u initialize v_counter as a 1 insted of 0 becoj in simple loop u have used 0 insted of 1 totally confused

vaibhavpatel
Автор

set serveroutput on
declare
a boolean:=true;
b number:=0;
c number :=0;
begin
while a loop
b:=b+1;
c:=19*b;
dbms_output.put_line('19 '||' x '||b||' =
if b =10 then
a:=false;
end if;
end loop;
dbms_output.put_line('outside loop');
end;
/

monkeyd.luffyd
Автор

I appreciate your efforts ... but please don't put banner of LIKE THIS VIDEO or SUSCRIBE in middle of your teaching its disturbs a lot and distracts focus and attention as you having very good PL/SQL series. You put them in end only like you do. We always like, share & subscribe your video as its fruitful...thanks...Wishing you will try to improve this problem in your future videos.

srajanjain
Автор

Answer of the home work:
SET SERVEROUTPUT ON;
DECLARE
V_NUMBER NUMBER := '&ENTER_NUMBER';
V_TEST BOOLEAN := TRUE;
V_COUNTER NUMBER := 0;
V_RESULT NUMBER;
BEGIN
WHILE V_TEST LOOP
V_COUNTER := V_COUNTER + 1;
V_RESULT := V_NUMBER * V_COUNTER;
X '||V_COUNTER||' = '||V_RESULT);
IF V_COUNTER = 10 THEN
V_TEST := FALSE;
END IF;
END LOOP;
END;
/

clearcoding
Автор

set serveroutput on
declare
v_counter boolean:= true;
v_num number:=0;
v_res number;
begin
while v_counter loop
v_num := v_num + 1;
v_res := 19 * v_num;

if v_num>=10 then
v_counter:=false;
end if;
end loop;
end;
/

for multiplication table of 19 using a boolean expression

nithyalakshmim
Автор

set SERVEROUTPUT ON
declare
v_test boolean :=true;
v_counter number :=0;
v_result number;
v_constant constant number := 19;
begin
while v_test loop
v_result:= v_constant * v_counter;
v_counter:= v_counter +1;
|| 'x' || v_counter || '='|| v_result);
if v_counter =100 then
v_test :=false;
end if;
end loop;
dbms_output.put_line('Outside the loop');
end;

Vykycy
join shbcf.ru