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

Practical Assignment 1

The document contains PL/SQL code snippets for various operations. It includes a program to multiply a user-defined number by integers from 1 to 10, a procedure to insert student records into a table with classification based on percentage, and a script to print odd numbers between two user-defined positive integers. The code demonstrates basic control structures and database interactions in PL/SQL.
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)
2 views2 pages

Practical Assignment 1

The document contains PL/SQL code snippets for various operations. It includes a program to multiply a user-defined number by integers from 1 to 10, a procedure to insert student records into a table with classification based on percentage, and a script to print odd numbers between two user-defined positive integers. The code demonstrates basic control structures and database interactions in PL/SQL.
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

num number;
mt number;
begin
dbms_output.put_line('enter number');
num:=#
for i in 1..10 loop
mt:=i*num;
dbms_output.put_line(mt);
end loop;
end;
/

create table st(rno number primary key,sname varchar(20),class varchar(20),per


number(2),perclass varchar(20));

declare
rno st.rno%type;
name st.sname%type;
class st.class%type;
per st.per%type;
perclass st.perclass%type;
begin
rno:='&rno';
name:='&sname';
class:='&class';
per:='&per';
IF(per>=75 and per<=100)THEN
perclass:='distinction';
ELSE IF(per>=60 and per<75)THEN
perclass:='firstclass';
ELSE IF(per>=55 and per<60)THEN
perclass:='higher second class';
ELSE IF(per>=50 and per<55)THEN
perclass:='second class';
else
perclass:='fail';
end IF;
end IF;
end IF;
end IF;
insert into st values(rno,name,class,per,perclass);
dbms_output.put_line('one record inserted successfully.....!');
End;
/

DECLARE
num1 number;
num2 number;
BEGIN
DBMS_OUTPUT.PUT_LINE('enter the first number');
num1:=&num1;
DBMS_OUTPUT.PUT_LINE('enter the second number');
num2:=&num2;
IF num1>0 AND num2>0 THEN
DBMS_OUTPUT.PUT_LINE('odd numbers between'||num1||'and'||num2||':');
FOR i IN num1..num2 LOOP
IF MOD(i,2)=1 THEN
DBMS_OUTPUT.PUT_LINE(i);
END IF;
END LOOP;
ELSE
DBMS_OUTPUT.PUT_LINE('Both the numbers should be positive');
END IF;
END;
/

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