الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

How To Create A Function

بدأه العيسري44 في 9 مايو 2008 · 1 رد · 1,556 مشاهدة · في قسم لغةالاجرائات Pl/sql
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

create table student(studid number primary key,studname varchar2(20),mark1 number,mark2 number,mark3 number);

Q1. how to create a function that will accept the three marks of student and will determine and return the average mark to the calling block

#2
FUNCTION get_avg_degree (st_Code NUMBER) RETURN number IS
avg_degree number;
ccount number;

BEGIN
				select count(*) into ccount from students wherestudent_id= st_Code ;
			if ccount=0 then
				return 0;
			else
				select (nvl(degree1,0)+nvl(degree1,0)+nvl(degree1,0))/3 into avg_degree  from students wherestudent_id= st_Code				return avg_degree;
			end if;

END;

مواضيع مشابهة