MySQL Forums
Forum List  »  Stored Procedures

Re: Stored procedure, holidays
Posted by: Rick James
Date: July 18, 2014 12:24PM

Personally, I would write most of it in a real language, not MySQL Stored Procedure half-language.

An optimization:
SET @diff = (SELECT DATEDIFF(eindD, startD) AS diffdate FROM verlofdagen WHERE idverlofdagen = v_id);
SET @firstdays = (SELECT startD FROM verlofdagen WHERE idverlofdagen = v_id);
-->
SELECT
@diff := DATEDIFF(eindD, startD),
@firstdays := startD
FROM verlofdagen WHERE idverlofdagen = v_id

That is do a single select to fetch all the values possible for "idverlofdagen = v_id".

Options: ReplyQuote


Subject
Views
Written By
Posted
2509
July 17, 2014 01:03AM
1268
July 17, 2014 08:56AM
1128
July 18, 2014 05:03AM
Re: Stored procedure, holidays
982
July 18, 2014 12:24PM


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.