0% found this document useful (0 votes)
90 views

Assignment 1 & 2 101715087

The document is a practical activity report submitted by student Mridul Mahindra for their Database Management Systems course. It contains solutions to 8 questions involving PL/SQL programming concepts like conditional statements, loops, functions and string manipulation. The report is submitted to their professor Dr. Sidharth Quamara of the Department of Computer Science and Engineering at Thapar Institute of Engineering & Technology.

Uploaded by

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

Assignment 1 & 2 101715087

The document is a practical activity report submitted by student Mridul Mahindra for their Database Management Systems course. It contains solutions to 8 questions involving PL/SQL programming concepts like conditional statements, loops, functions and string manipulation. The report is submitted to their professor Dr. Sidharth Quamara of the Department of Computer Science and Engineering at Thapar Institute of Engineering & Technology.

Uploaded by

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

A Practical Activity Report For

Database Management Systems (UCS310)

Submitted By:

Name: Mridul Mahindra


Roll Number: 101715087
Group: ENC - 4

Submitted To:
Dr. Sidharth Quamara

Depatment of Computer Science and Engineering

THAPAR INSTITUTE OF ENGINEERING & TECHNOLOGY, (DEEMED TO BE


UNIVERSITY), PATIALA, PUNJAB
Lab Assignment 1

Q1.
DECLARE
a NUMBER := 144;
b NUMBER := 59;
c NUMBER := 185;
BEGIN
IF a > b
AND a > c THEN
dbms_output.Put_line('Greatest number is '||a);
ELSIF b > a
AND b > c THEN
dbms_output.Put_line('Greatest number is '||b);
ELSE
dbms_output.Put_line('Greatest number is '||c);
END IF;
END;
Output:
Q2.
DECLARE
n NUMBER := 164;
r NUMBER;
BEGIN
r := MOD(n, 2);

IF r = 0 THEN
dbms_output.Put_line('Even');
ELSE
dbms_output.Put_line('Odd');
END IF;
END;
Output:
Q3.
DECLARE
variable_Score Number := 95;
variable_LetterGrade Char(1);
BEGIN
IF variable_Score >= 90 THEN
variable_LetterGrade := 'A';
ELSIF variable_Score >= 80 THEN
variable_LetterGrade := 'B';
ELSIF variable_Score >= 70 THEN
variable_LetterGrade := 'C';
ELSIF variable_Score >= 60 THEN
variable_LetterGrade := 'D';
ELSE
variable_LetterGrade := 'E';
END IF;
DBMS_OUTPUT.PUT_LINE('Your Letter Grade is: ' || variable_LetterGrade);
END;
/
Output:
Q4.
declare
n number := 5;
i number;
begin
for i in 1..10
loop
dbms_output.put_line(n||' x '||i||' = '||n*i);
end loop;
end;
/
Output:

Q5.
Declare
num number:= 5;
fact number:= 1;
temp number;
begin
temp := num;
while (num > 0)
loop
fact := fact * num;
num := num - 1;
end loop;
Dbms_Output.Put_line('factorial of ' || temp || ' is ' || fact);
end;
/
Output:

Q6.
declare
first number := 0;
second number := 1;
temp number;
n number := 5;
i number;
begin
dbms_output.put_line('Series:');
dbms_output.put_line(first);
dbms_output.put_line(second);
for i in 2..n
loop
temp:=first+second;
first := second;
second := temp;
dbms_output.put_line(temp);
end loop;
end;
Output:
Q7.
declare
n number:=12345;
i number;
rev number:=0;
r number;
begin
while n>0
loop
r:=mod(n,10);
rev:=(rev*10)+r;
n:=trunc(n/10);
end loop;
dbms_output.put_line('reverse is '||rev);
end;
/
Output:
Q8.
DECLARE
str VARCHAR(50) := 'ThisPandemicWillEndSoon!';
len NUMBER;
str1 VARCHAR(50);
BEGIN
len := Length(str);
FOR i IN REVERSE 1.. len LOOP
str1 := str1 || Substr(str, i, 1);
END LOOP;
dbms_output.Put_line('Reverse of string is '|| str1);
END;
Output:
Lab Assignment 2

Q1.

Q2.
Q3.
Q4.
Q5.

Q6.
Q7.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy