RDBMS SOLUTION


ASSIGNMENT 1 

SET b Q.1 SOLUTION

Write a PL/SQL block which will accept roll number of a student and display record of student from student table( use %ROWTYPE attribute)




Source code:

    

    /*set b Q.1*/

    /*in this question,will use %row type

        in a short manner,%row type is used for getting

            data type of whole row in just 1 variable*/

/*logic is that will be getting student roll no. and then print the record.

              but first lets add some records in student table*/

declare

std_rec student%rowtype;

t number:=:roll_no;

begin

select * into std_rec from student where rno=t;

dbms_output.put_line('roll number      name      class    percentage');

dbms_output.put_line(std_rec.rno||'       '||std_rec.sname||'       '||std_rec.sclass||'       '||std_rec.sper);

    end;   

   

    
 Download code         next