MySQL Forums
Forum List  »  Stored Procedures

Re: Student_id and MAX score in one OUT parameter
Posted by: Peter Brawley
Date: May 13, 2016 07:55AM

The requirement you describe is unclear. To return a student_id and her max score requires just one student_id, no need for "start" and "end" student_ids. There's no need for her name either, or for Group By aggregation. Or for delimiter directives since the job can be done in one logical line ...

drop procedure if exists max_score;
create procedure max_score( in pid int, out rc varchar(128) )
set rc = concat( "student ", pid, " highest score is ", (select max(score) from score where student_id=pid) );
set @rc='';
call max_score(1,@rc );
select @rc;

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Student_id and MAX score in one OUT parameter
899
May 13, 2016 07:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.