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; DBMS_OUTPUT.PUT_LINE(v_counter||' x '|| 19 ||' = '||v_result); IF v_counter =10 THEN v_test := FALSE; END IF; END LOOP; DBMS_OUTPUT.PUT_LINE('Outside the Loop'); END;
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.
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;
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; dbms_output.put_line(19||'X'||v_num||'='||v_res); if v_num>=10 then v_counter:=false; end if; end loop; end; / for multiplication table of 19 using a boolean expression
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.
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; DBMS_OUTPUT.PUT_LINE(V_NUMBER||' X '||V_COUNTER||' = '||V_RESULT); IF V_COUNTER = 10 THEN V_TEST := FALSE; END IF; END LOOP; END; /
Thank you so much. I am really glad that you enjoyed my videos. Your appreciation means a lot to me. Regarding IDE, I am using a free tool offered by Oracle itself, it’s called SQL Developer. Check out this video here I have explained how to download and configure it. Step 1: Download and setup SQL Developer th-cam.com/video/zliF8kXVmeE/w-d-xo.html Step 2: How To Connect Your Database With SQL Developer Oracle 11g - www.rebellionrider.com/how-to-make-new-database-connection-in-sql-developer-rebellionrider/ Oracle 12c - th-cam.com/video/tLFjwyHCEqk/w-d-xo.html Oracle 18c - th-cam.com/video/1gvN1A6xnxU/w-d-xo.html Thanks and have a great day!
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?
Yep this is the entire syllabus. Can't say anything about fresher interview but people from around the world messaged and commented that they got job after learning Oracle from this channel. Some even said that their interviewer asked the same question that I have listed down in my blogs. So, don't worry, learn from this channel and my blog (www.rebellionrider.com) and practice. All the best for your future 😊
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; /
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
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; dbms_output.put_line(v_constant || '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;
set SERVEROUTPUT ON; DECLARE v_counterA number :=1; v_counterB number :=1; v_result number ; v_stop boolean:=true; BEGIN while v_stop LOOP v_result := v_counterB*v_counterB; DBMS_OUTPUT.PUT_LINE(v_counterA || ' x ' || v_counterB || ' = ' || v_result); v_counterA := v_counterA +1; v_counterB:=v_counterB+1; IF v_counterA = 10 then v_stop := false; END IF; END LOOP; DBMS_OUTPUT.PUT_LINE('OUTSITE FROM THE LOOP'); END;
set SERVEROUTPUT ON; cl scr; DECLARE a NUMBER:=&Enter_the_number; b NUMBER:=0; c NUMBER; d boolean:=True; BEGIN while d loop b:=b+1; c:=a*b; DBMS_OUTPUT.PUT_LINE(a||'X'||b||'='||c); if b=10 then d:=false; end if; end loop; end;
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;
DBMS_OUTPUT.PUT_LINE(v_counter||' x '|| 19 ||' = '||v_result);
IF v_counter =10 THEN
v_test := FALSE;
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE('Outside the Loop');
END;
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.
YOU ARE RIGHT . I DID IT.
v_counter := v_counter + 1;
v_test := (v_counter < 10);
DBMS_OUTPUT.PUT_LINE(v_counter);
With simple example you explain the concept very well. thank you Sir for awesome learning
Instead of that if condition for terminate loop can we use exit when commend like
EXIT WHEN v_counter >= 10; (Boolean program)
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;
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;
dbms_output.put_line(19||'X'||v_num||'='||v_res);
if v_num>=10 then
v_counter:=false;
end if;
end loop;
end;
/
for multiplication table of 19 using a boolean expression
well done 👍
@@Rebellionrider 😊
dude you are saviour
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.
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;
DBMS_OUTPUT.PUT_LINE(V_NUMBER||' X '||V_COUNTER||' = '||V_RESULT);
IF V_COUNTER = 10 THEN
V_TEST := FALSE;
END IF;
END LOOP;
END;
/
Can anyone please tell me what is this IDE abd how to download it......nice explanation btw...thanks for making such videos✌️
Thank you so much. I am really glad that you enjoyed my videos. Your appreciation means a lot to me. Regarding IDE, I am using a free tool offered by Oracle itself, it’s called SQL Developer. Check out this video here I have explained how to download and configure it.
Step 1: Download and setup SQL Developer
th-cam.com/video/zliF8kXVmeE/w-d-xo.html
Step 2: How To Connect Your Database With SQL Developer
Oracle 11g - www.rebellionrider.com/how-to-make-new-database-connection-in-sql-developer-rebellionrider/
Oracle 12c - th-cam.com/video/tLFjwyHCEqk/w-d-xo.html
Oracle 18c - th-cam.com/video/1gvN1A6xnxU/w-d-xo.html
Thanks and have a great day!
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?
SET SERVEROUTPUT ON;
DECLARE
u_multiply BOOLEAN :=TRUE;
u_counter NUMBER :=0;
u_result NUMBER;
BEGIN
WHILE u_multiply LOOP
u_counter:= u_counter +1;
u_result :=16 * u_counter;
DBMS_OUTPUT.PUT_LINE ('16'|| ' x '|| u_counter||' = '||u_result);
IF u_counter >=10 THEN
u_multiply :=FALSE;
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE ('LOOP ENDED.THANKS MANISH');
END;
/
hi manish
my question is what is the use of boolean expression as a test condition in while loop
Hi Manish, I am executing a package.sp from shell script. How do I use SERVEROUTPUT ON for DBMS_OUTPUT.PUT_LINE?..please help
SIR, I HAVE CONPLETED SQL. SIR IS IT COMPLETE SYLLEBUS FOR PLSQL FOR FRESHERS INTERVIEW ...?? PLZ SUGGEST ME SIR
Yep this is the entire syllabus. Can't say anything about fresher interview but people from around the world messaged and commented that they got job after learning Oracle from this channel. Some even said that their interviewer asked the same question that I have listed down in my blogs. So, don't worry, learn from this channel and my blog (www.rebellionrider.com) and practice. All the best for your future 😊
Is it can be debugged by without creating functions, proc or package?
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;
/
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
set serveroutput on;
declare
vcounter number :=1;
vresult number;
vtest boolean :=TRUE;
begin
while vcounter
sir please make video on static and dynamic sql
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;
dbms_output.put_line(v_constant || '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;
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
set SERVEROUTPUT ON;
DECLARE
v_counterA number :=1;
v_counterB number :=1;
v_result number ;
v_stop boolean:=true;
BEGIN
while v_stop LOOP
v_result := v_counterB*v_counterB;
DBMS_OUTPUT.PUT_LINE(v_counterA || ' x ' || v_counterB || ' = ' || v_result);
v_counterA := v_counterA +1;
v_counterB:=v_counterB+1;
IF v_counterA = 10 then v_stop := false;
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE('OUTSITE FROM THE LOOP');
END;
DECLARE
v_counter NUMBER:=0;
v_result NUMBER:=0;
v_test BOOLEAN:= TRUE;
BEGIN
WHILE v_test LOOP
v_counter := v_counter +1;
v_result := 10*v_counter;
DBMS_OUTPUT.PUT_LINE('10'||'x'||v_counter||'='||v_result);
IF v_counter=10 THEN
v_test:= FALSE;
END IF;
END LOOP;
END;
THANKS
set SERVEROUTPUT ON;
cl scr;
DECLARE
a NUMBER:=&Enter_the_number;
b NUMBER:=0;
c NUMBER;
d boolean:=True;
BEGIN
while d loop
b:=b+1;
c:=a*b;
DBMS_OUTPUT.PUT_LINE(a||'X'||b||'='||c);
if b=10 then
d:=false;
end if;
end loop;
end;
how to increse text size in sql developer ?
How to come out from infinity loop?
By using exit or exit when clause you can come out from infinity loop