Skip to main content

Pl/SQL Program of Function and Cursor together



create or replace function findcourse(name_in in varchar2) return number; is
c_number number;
cursor c1 is
select stu_roll from student where stu_name = name_in;

begin
open c1;
 fetch c1 into c_number;
  if c1%notfound then c_number = 9696;
end if;
 close c;
 return c_number;
end;

Comments

Popular posts from this blog

Pl/SQL program to find square of a user input number Using Function

declare   value1 number;   value2 number;   mytotal number;   function myfun(myval1 in number, myval2 in number) return number is     total number;   begin     total := myval1 ** myval2;     dbms_output.put_line(total);     return total;   end; begin   value1 :=&val1;   value2 := &val2;  mytotal:= myfun(value1, value2); end;