MySQL Forums
Forum List  »  MySQL Query Browser

Trouble with variables in querires
Posted by: Benjamin McWhorter
Date: March 30, 2012 08:08AM

Hi, I'm having some huge difficulties with some variables in a simple trigger I was trying to write. I've tried this both ways -- declaring the variables and the way I am about to post and both show they have the correct syntax, but when you go to execute, they get errors. this code works well up until the while loop. In fact the SELECT DATE_FORMAT(@Out_Next_Expected_Due_Date,'%w'); statement will correctly print what I expect. Please help! I'm using mysql version 5.1.61. I will be monitoring this closely so any questions will be promptly answered. Thanks in advance.

-Ben

SELECT @In_Last_Expected_Due_Date:=FixedNextPaymentDate from tbl_loans where LoanID = 649;

SELECT @In_Pfreq_Code:=PayFrequency from tbl_loans where LoanID = 649;

-- **************************
SELECT @LV_Pfreq_Category_Code:=Pfreq_Category_Code FROM tbl_Pay_Frequency WHERE Pfreq_Code = @In_Pfreq_Code;

-- **************************

SELECT DATE_FORMAT(@Out_Next_Expected_Due_Date,'%w'),@In_Last_Expected_Due_Date,@Out_Next_Expected_Due_Date:=ADDDATE(@In_Last_Expected_Due_Date,8);
SELECT DATE_FORMAT(@Out_Next_Expected_Due_Date,'%w');
WHILE DATE_FORMAT(@Out_Next_Expected_Due_Date,'%w') != 1 DO
BEGIN
SELECT @Out_Next_Expected_Due_Date:=ADDDATE(@Out_Next_Expected_Due_Date,1);
END;
END WHILE;

Options: ReplyQuote


Subject
Written By
Posted
Trouble with variables in querires
March 30, 2012 08:08AM


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.