SQL program to print the fees of student whose roll no is given as input using function


FUNCTIONS                                 
 
AIM:

To write  a PL/SQL program to print the fees of student whose roll no is given as input using function.


ALGORITHM:

                        Step 1:start the program
                        Step 2:Create a function named greatest with 3 input aruguments a,b,c
                                    and output argument  as g
                        Step 3:If a is greater than b and c then  assign to g else check if b is
                                    greater than assign 0 to g
Step 4 .Return the value of g.
Step 5. Stop the program


PROGRAM:

Sql >create or replace function  fun(rno in number) return number is n number;
2  begin
                        3  select fees into n from student where sturno=rno;
                        4  return(n);
                        5  end;
                        6  /

Warning: Function created with compilation errors.

SQL> declare
                        2  a number(5);
                        3  b number (8);
                        4  begin
                        5  a:=&a;
                        6  b:=&b;
                        7  dbms_output.put_line(b);
                        8  end;
                        9  /

OUTPUT:


Enter value for a: 20
old   5: a:=&a;
new   5: a:=20;
Enter value for b: 25
old   6: b:=&b;
new   6: b:=25;

PL/SQL procedure successfully completed.

0 comments:

Post a Comment