Category: PL/SQL Simple Programs

PL/SQL Program to Accept Number and Print in Alphabet 0

PL/SQL Program to Accept Number and Print in Alphabet

Follow me PL/SQL Program to Accept Number and Print in Alphabet: declare no number; no_to_word varchar2(100); str varchar2(100); len number; c number; begin no:=:no; len:=Length(no); dbms_output.put_line(‘Entered Number is: ‘||no); for i in 1..len loop...

PL/SQL Program to Find GCD of Two Numbers 2

PL/SQL Program to Find GCD of Two Numbers

Follow me PL/SQL Program to Find GCD of Two Numbers : declare no1 number; no2 number; temp number; begin no1:=:no1; no2:=:no2; while mod(no2,no1)!=0 loop temp:=mod(no2,no1); no2:=no1; no1:=temp; end loop; dbms_output.put_line(‘GCD of ‘||no1||’ and ‘||no2||’...

PL/SQL Program to Find Square of Number 0

PL/SQL Program to Find Square of Number

Follow me PL/SQL Program to Find Square of Number: declare no number; sqr number; begin no:=:no; sqr:=no*no; dbms_output.put_line(‘Given Number is ‘||no); dbms_output.put_line(‘ ‘); dbms_output.put_line(‘Square of Number is ‘||sqr); end; You may also like: How...

PL/SQL Program to Find Length of String 0

PL/SQL Program to Find Length of String

Follow me PL/SQL Program to Find Length of String: declare str varchar2(20); len number; begin str:=:str; len:=Length(str); dbms_output.put_line(‘Given String is ‘||str); dbms_output.put_line(‘ ‘); dbms_output.put_line(‘Length of String is ‘||len); end; OUTPUT: Given String is BaronTuts...

PL/SQL Program to Find Area and Perimeter of Rectangle 0

PL/SQL Program to Find Area and Perimeter of Rectangle

Follow me PL/SQL Program to Find Area and Perimeter of Rectangle : declare length number; width number; area number; perimeter number; begin length:=:length; width:=:width; area:=length*width; perimeter:= 2*(length+width); dbms_output.put_line(‘AREA OF RECTANGLE IS:’||area); dbms_output.put_line(‘ ‘); dbms_output.put_line(‘PERIMETER...

PL/SQL Program to Find Area of Circle 0

PL/SQL Program to Find Area of Circle

Follow me PL/SQL Program to Find Area of Circle: declare radius float; area float; begin radius:=:radius; area:=3.14*radius*radius; dbms_output.put_line(‘The area of circle is ‘||area); end; OUTPUT: Radius is 3 The area of circle is 28.26

PL/SQL Program to Swap Two Number Without Using Third Variable 0

PL/SQL Program to Swap Two Number Without Using Third Variable

Follow me PL/SQL Program to Swap Two Number Without Using Third Variable: declare a number; b number; begin a:=:a; b:=:b; dbms_output.put_line(‘Value of a is ‘||a); dbms_output.put_line(‘Value of b is ‘||b); a:=a||b; b:=replace(a,b); a:=replace(a,b); dbms_output.put_line(‘...

PL/SQL Program to Swap Two Strings 0

PL/SQL Program to Swap Two Strings

Follow me PL/SQL Program to Swap Two Strings: declare a varchar2(10); b varchar2(10); begin a:=:a; b:=:b; dbms_output.put_line(‘Value of a is ‘||a); dbms_output.put_line(‘Value of b is ‘||b); a:=a||b; b:=replace(a,b); a:=replace(a,b); dbms_output.put_line(‘ ‘); dbms_output.put_line(‘After Swapping: ‘);...

PL/SQL Program to Reverse the given String 0

PL/SQL Program to Reverse the given String

Follow me PL/SQL Program to Reverse the given String: declare str1 varchar2(30); len number; str2 varchar2(30); i number; begin str1:=:str1; len:=length(str1); for i in reverse 1..len loop str2:=str2 || substr(str1,i,1); end loop; dbms_output.put_line(‘Given string...

PL/SQL Program to Display Multiplication Table 0

PL/SQL Program to Display Multiplication Table

Follow me PL/SQL Program to Display Multiplication Table: declare i number; no number; begin no:=:no; for i in 1..10 loop dbms_output.put_line( no || ‘ * ‘ || i || ‘ = ‘ || no*i);...