what i am trying do is calculate easch student result for a specific semester using the formula total of moudles taken divided by the number of modules. Then i would need the system to display 'DISTINCTION' and the student's name if result is above 70, PASS if its between 50 - 69 and FAIL if its below 50. This are my tables: Student create table student (St_id varchar2 (5) PRIMARY KEY, LastName varchar2 (10), FirstName varchar2 (10), Address varchar2 (30), Postcode varchar2 (9), Tel_No integer, DOB date, Gender varchar2 (1), Email varchar2 (30)); example of data: INSERT INTO STUDENT VALUES (‘ST01’,’Cali’, ‘Salim’,’22 Linton Road’,’G1 8HT’,’07958217212’,’12-DEC-80’,’M’, ‘gg21@hotmail.com’); Module M_id ML_id M_Title Semester example of data: INSERT INTO MODULE VALUES (‘CB151’,’ML01’,’Software Development’, ‘A’); STMD (The linker table) St_id M_id Pathway Result example of data: INSERT INTO STMD VALUES (‘ST01’,’CB154’, ‘Business Information Systems’, ‘90’); I have created a function that works it adds the results together and shows the percentages CREATE OR REPLACE FUNCTION Result( i_St_id stmd.St_id%TYPE) RETURN NUMBER IS v_result number(8); BEGIN select sum (result / 3) INTO V_result from stmd WHERE St_id = i_St_id; IF v_result IS NULL THEN v_result := 0; END IF; RETURN v_result; END; / i used this code to test it: select distinct result(stmd.st_id), firstname, semester from stmd, student, module where stmd.St_id = 'ST01' and student.st_id = 'ST01'; i then thought i used write procedure to display the grades Create or Replace procedure res(v_st_id IN stmd.st_id%TYPE) AS v_first_name student.firstname%TYPE; v_module_leader mleader.name%TYPE; v_last_name student.lastname%TYPE; v_res stmd.st_id%TYPE; Begin result(v_st_id) := v_res; for pnt in (select firstname, lastname, name from student, mleader) loop IF v_res >= 70 THEN DBMS_OUTPUT.PUT_LINE( pnt.firstname || ' ' || pnt.lastname || ' ' ||'YOU GOT A DISTINcTION' || ' ' || 'YOUR MODULE LEADER is' || ' ' || pnt.name); ELSIF v_res >= 50 THEN DBMS_OUTPUT.PUT_LINE( pnt.firstname || ' ' || pnt.lastname || ' ' ||'YOU GOT A PASS' || ' ' || 'YOUR MODULE LEADER is' || ' ' || pnt.name); ELSIF v_res <50 THEN DBMS_OUTPUT.PUT_LINE( pnt.firstname || ' ' || pnt.lastname || ' ' ||'YOU FAILED YOU NEED HELP' || ' ' || 'YOUR MODULE LEADER is' || ' ' || pnt.name); END IF; END LOOP; END; / but it dont work? can you help me? Thanks