RDBMS SOLUTION
ASSIGNMENT 1
SET A Q.2 SOLUTION
Write a PL/SQL block which will Accept student details,calculate the class using per value and insert the record into student
Source code:
/*set a Q.b solution*/
/*in this we will first create student table
and then insert records using variables*/
create table student
(
rno number not null,
sname varchar2(40),
sclass varchar2(10),
sper number
);
/*after creating table, will write plsql block*/
declare
rno number:=:roll_no;
sname varchar2(40):=:sname;
sclass varchar2(40):=:sclass;
sper number:=:percentage;
/*the record will be inserted in these variables
now for inserting these inputted record in table,will use insert into query*/
begin
insert into student values(rno,sname,sclass,sper);
/*here will show user that row is inserted*/
dbms_output.put_line('inserted');
end;
0 Comments