HomeОбразованиеRelated VideosMore From: Manish Sharma

PL/SQL tutorial 9: IF THEN ELSE (IF-ELSE) Statement in PL/SQL by Manish Sharma

548 ratings | 57670 views
3rd tutorial in the series explaining IF-THEN-ELSE statement in Oracle PL/SQL with Example. Enjoy ------------------------------------------------------------------------ ►►►LINKS◄◄◄ Blog : http://bit.ly/if-then-else Previous Tutorial ► IF THEN Statement https://youtu.be/IWvuFD6eD30 ------------------------------------------------------------------------- ►►►Let's Get Free Uber Cab◄◄◄ Use Referral Code UberRebellionRider and get $20 free for your first ride. ------------------------------------------------------------------------- ►►►Help Me In Getting A Job◄◄◄ ►Help Me In Getting A Good Job By Connecting With Me on My LinkedIn and Endorsing My Skills. All My Contact Info is Down Below. You Can Also Refer Me To Your Company Thanks ------------------------------------------------------------------------- ►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 https://twitter.com/rebellionrider https://www.facebook.com/imthebhardwaj http://instagram.com/rebellionrider https://plus.google.com/+Rebellionrider http://in.linkedin.com/in/mannbhardwaj/ http://rebellionrider.tumblr.com/ http://www.pinterest.com/rebellionrider/ 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 This is Manish from RebellionRider.com ♥ I LOVE ALL MY VIEWERS AND SUBSCRIBERS
Html code for embedding videos on your blog
Text Comments (31)
Manish Semwal (1 month ago)
Can you do- if(num%2==0) then dbms_output.put_line(num||' is even'); else dbms_output.put_line(num||' is odd'); end if;
Ankit Dubey (1 month ago)
Thanks bro
hamdaoui mohamed zakaria (3 months ago)
THANKS MANISH VERY USEFULL LIKE USUALLY
Lakshay Vinayak (5 months ago)
In first slide u write if then else Instead of if then ...
yuva raj (5 months ago)
'&' is not working for me. any idea or any other options available? error: ORA-06550: line 2, column 17: PLS-00103: Encountered the symbol "&" when expecting one of the following: ( - + case mod new not null <an identifier> <a double-quoted delimited-identifier> <a bind variable> continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specification> <an alternatively
Constantin Alexandru (8 months ago)
hI Manish Why you put the last statement 3 into syntax ? This is not a part of the IF THEN ELSE condition right ?
harman bawa (8 months ago)
Thank Manish :)
anchal therkar (1 year ago)
sir ap be Jo link provide ki hai that's not opening..what should I do?
anchal therkar (1 year ago)
thnku sir for your quick reply...
Manish Sharma (1 year ago)
I'm sorry for your inconvenience. I am sure there must be some glitch. Here I am providing you the direct link to the blog please try this http://www.rebellionrider.com/pl-sql-tutorials/conditional-control-statements-in-pl-sql/if-then-else-statements-in-pl-sql-manish-sharma.htm#.Wb6-YMgjHIV Hope this will work. Thanks and have a great day.
Csaba Somogyi (1 year ago)
&enter_a_number doesn't work for me. ORA-06550: line 2, column 18: PLS-00103: Encountered the symbol "&" when expecting one of the following: ( - + case mod new not null <an identifier> <a double-quoted delimited-identifier> <a bind variable> continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specif 1. DECLARE 2. v_num NUMBER := &enter_a_number; 3. BEGIN 4. IF MOD (v_num, 2) = 0 THEN
hard reset (1 year ago)
bro you are rocking in my college
vilas patil (1 year ago)
One question here -- I have executed thePLSQL I am getting o/p with PLSQL snytax as well please suggest what is going wrong . PLSQL: set serveroutput on; DECLARE vnum NUMBER := &Nu; BEGIN if mod(vnum,2)=0 then dbms_output.put_line(vnum || 'is even'); else dbms_output.put_line(vnum || 'is odd'); end if; dbms_output.put_line('End of if esle end if'); END; / O/p is old:DECLARE vnum NUMBER := &Nu; BEGIN if mod(vnum,2)=0 then dbms_output.put_line(vnum || 'is even'); else dbms_output.put_line(vnum || 'is odd'); end if; dbms_output.put_line('End of if esle end if'); END; new:DECLARE vnum NUMBER := 14; BEGIN if mod(vnum,2)=0 then dbms_output.put_line(vnum || 'is even'); else dbms_output.put_line(vnum || 'is odd'); end if; dbms_output.put_line('End of if esle end if'); END; 14is even End of if esle end if PL/SQL procedure successfully completed. why am getting the entire o/p instead of only expected one:?
ridheen (1 year ago)
nice.. but i wanted to know about mod(v_num,2) = 0 and also how and wen we should use the symbol || ??? kindly reply or mail to [email protected]
Joenard Tan (8 months ago)
the symbol || is what we called concat
Hi 'MANISH' 'AZAR' here... Thank you very much for providing a structured flow of tutorials, i am enjoying a lot and learning new things... I have a request for you, can you please make some example on CONDITIONAL STATEMENTS with more statements within a loop..
Namrata Satpute (1 year ago)
very nice way of teaching...:)...Request you to please upload detail video on datatypes in PL/SQL.
Ahmed Musa Sule (1 year ago)
NICE
tripti choudhary (1 year ago)
don't we need to define the data width of NUMBER type variable while declaration..??
mayank agarwal (7 months ago)
i hv the same question
Saratkumar Kedarisetty (2 years ago)
by useing if then else i want to update marks in a table....
troy raphael ablanida (2 years ago)
Easy to understand, deserves subscription and likes
Gulzar siddique (2 years ago)
declare a number:=&x; b number:=&y; result number; begin result:=a+b; if result between 10 and 99 dbms_output.put_line( result || ' is two digit number '); else dbms_output.put_line( result || ' is single digit number '); end if; end; plz give me solution sir,
Bharath Kumar (1 year ago)
All of your code is well and good except the 'then' keyword which is missing after your first condition in execution statement. The proper code would be like below: declare a number:=&x; b number:=&y; result number; begin result:=a+b; if result between 10 and 99 then dbms_output.put_line( result || ' is two digit number '); else dbms_output.put_line( result || ' is single digit number '); end if; end;
Hemu Kalyandurga (2 years ago)
Buddy can you do videos on cursors and collections.. Like the way you present things.. Its really easy to understand
Manish Sharma (2 years ago)
Hey Hemu. Thank you so much for the appreciation, I am really glad to know that you enjoyed the content on my YouTube channel. I have already done a series on Database Cursors and Will soon upload the videos on Collection and other PL/SQL topics, Stay tuned and keep enjoying watching. Do make sure to Like, Share & Subscribe.
Sheik Sulaiman (2 years ago)
SET SERVEROUTPUT ON; DECLARE v_name VARCHAR2(10) := '&enter_the_name'; v_pass VARCHAR2(8) := '&eneter_the_password'; BEGIN IF v_name := 'Rebelion' and v_pass := 'rider' THEN DBMS_OUTPUT.PUT_LINE('THIS IS ADMIN'); ELSE DBMS_OUTPUT.PUT_LINE('SORRY TRY AGAIN'); END IF; DBMS_OUTPUT.PUT_LINE('ADMIN CHECKING FINISH'); END; please check and tell this satement correct or wrong
Joenard Tan (8 months ago)
DECLARE v_name VARCHAR2(10) := '&enter_the_name'; v_pass VARCHAR2(8) := '&eneter_the_password'; BEGIN IF v_name = 'Rebelion' and v_pass = 'rider' THEN DBMS_OUTPUT.PUT_LINE('THIS IS ADMIN'); ELSE DBMS_OUTPUT.PUT_LINE('SORRY TRY AGAIN'); END IF; DBMS_OUTPUT.PUT_LINE('ADMIN CHECKING FINISH'); END;
dhananjay bhade (2 years ago)
SET SERVEROUTPUT ON; DECLARE v_name VARCHAR2(10) := '&enter_the_name'; v_pass VARCHAR2(8) := '&eneter_the_password'; BEGIN IF v_name = 'Rebelion' and v_pass = 'rider' THEN DBMS_OUTPUT.PUT_LINE('THIS IS ADMIN'); ELSE DBMS_OUTPUT.PUT_LINE('SORRY TRY AGAIN'); END IF; DBMS_OUTPUT.PUT_LINE('ADMIN CHECKING FINISH'); END; Try this... Remove assignment operator in "IF v_name := 'Rebelion' and v_pass := 'rider' THEN"
Venkatesh R (2 years ago)
good tutorials
rachna sharma (3 years ago)
plz explain function,cursor topics as well.. in b/w i like how u teach.. really make me understand.. Thanks for nice tutorials..

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.