0% found this document useful (0 votes)
12 views2 pages

PLSQL Prog

Uploaded by

satyendra.pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

PLSQL Prog

Uploaded by

satyendra.pal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Declare

r int :=5;
a float;
begin
a:=3.14*r*r;
dbms_output.put_line('Area = '||a);
end;
/

Write a PL/SQl program to swap 2 numbers

Declare
a int :=10;
b int :=20;
c int :=a;
begin
dbms_output.put_line('Before swap a= '||a);
dbms_output.put_line('before swap b= '||b);
a :=b;
b :=c;
dbms_output.put_line('After swap a= '||a);
dbms_output.put_line('After swap b= '||b);
end;
/

write PL/SQL program to find the greatest no out of 3.

declare
a int :=100;
b int :=2000;
c int :=300;
begin
if a>b and a >c then
dbms_output.put_line('Greatest Number '||a);
elsif b>a and b >c then
dbms_output.put_line('Greatest Number '||b);
else
dbms_output.put_line('Greatest Number '||c);
end if;
end;
/
write PL/SQl block to find the given year is leap year or not.

Declare
year int;
begin
year:=&year;
if mod(year,400)=0 then
dbms_output.put_line('Given Year is Leap Year');
else
dbms_output.put_line('Given Year is not Leap Year');
end if;
end;
/
write PL/SQL block to find

<30000 low
31000>moderate <50000
>50000 high
DECLARE
ENO varchar(10);
SAL INT;
BEGIN
ENO:='&ENO';
SELECT ESAL INTO SAL FROM EMP WHERE EID=ENO;
IF SAL>50000 THEN
DBMS_OUTPUT.PUT_LINE('HIGH SALARY');
ELSIF SAL>30000 AND SAL<50000 THEN
DBMS_OUTPUT.PUT_LINE('MODERATE SALARY');
ELSE
DBMS_OUTPUT.PUT_LINE('LOW SALARY');
END IF;
END;
/

You might also like