Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR REPLACE FUNCTION min_grade_date (task_id number, student_id number)
- return varchar
- is
- tutor_id number;
- tutor_name varchar;
- begin
- select g.tutor_id
- into tutor_id
- from grades g, user_web u, solution s, task t
- where t.id = task_id
- and u.id = student_id
- and s.id = g.solution_id
- and g.grade_date = (select min(grade_date) from grades g, user_web u, solution s, task t
- where t.id = task_id
- and u.id = student_id
- and s.id = g.solution_id);
- select name into tutor_name from user_web where id = tutor_id;
- return tutor_name;
- end;
- select distinct s.student_id, t.title, min_grade_date(t.id, s.student_id)
- from grades g, user_web u, solution s, task t
- where t.id = s.task_id
- and s.id = g.solution_id
- and u.id = g.tutor_id
- order by s.student_id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement