MySQL Forums
Forum List  »  Stored Procedures

Re: Error Code: 1172. Result consisted of more than one row INSIDE A FUNCTION
Posted by: Peter Brawley
Date: March 14, 2022 11:12AM

create table if not exists iym ( doer date primary key, euro decimal(11,2) );
insert ignore into iym set doer=curdate(), euro=100.0;
drop function if exists euro;
delimiter go
CREATE FUNCTION `EURO`(FEC DATE ) RETURNS decimal(11,2)
BEGIN
  SET @TODAY=FEC;
  SELECT EURO FROM IYM WHERE DOER=@TODAY INTO @RESULT ;
  RETURN @RESULT ;
END;
go
delimiter ;
select euro( curdate() );
select euro( curdate() );
+-------------------+
| euro( curdate() ) |
+-------------------+
|            100.00 |
+-------------------+



Edited 1 time(s). Last edit at 03/14/2022 11:13AM by Peter Brawley.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Error Code: 1172. Result consisted of more than one row INSIDE A FUNCTION
99
March 14, 2022 11:12AM


Sorry, only registered users may post in this forum.

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.