![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
CREATE FUNCTION Months_Ahead(Input_Date Date) RETURNS Integer DETERMINISTIC begin RETURN period_diff(concat(Year(Input_Date), lpad(Month(Input_Date), 2,0)), concat(Year(curdate()), lpad(Month(curdate()),2,0))); end |
#3
| |||
| |||
|
|
On 12/13/2010 6:26 PM, MartinH wrote: CREATE FUNCTION Months_Ahead(Input_Date Date) * *RETURNS Integer * *DETERMINISTIC begin * *RETURN period_diff(concat(Year(Input_Date), lpad(Month(Input_Date), 2,0)), concat(Year(curdate()), lpad(Month(curdate()),2,0))); end How are you creating the function? *From the MySQL CLI, for instance? If so, you need to set a delimiter because the ';' is used inside the function. *For instance, the following works from the MySQL CLI: Delimiter // CREATE FUNCTION Months_Ahead(Input_Date Date) * *RETURNS Integer * *DETERMINISTIC begin * *RETURN period_diff(concat(Year(Input_Date), lpad(Month(Input_Date), 2,0)), concat(Year(curdate()), lpad(Month(curdate()),2,0))); end; // delimiter ; -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstuck... (AT) attglobal (DOT) net ================== |
#4
| |||
| |||
|
|
CREATE FUNCTION Months_Ahead(Input_Date Date) RETURNS Integer DETERMINISTIC begin RETURN period_diff(concat(Year(Input_Date), lpad(Month(Input_Date), 2,0)), concat(Year(curdate()), lpad(Month(curdate()),2,0))); end |
![]() |
| Thread Tools | |
| Display Modes | |
| |