0

this is my stored procedure:

CREATE DEFINER=`root`@`localhost` PROCEDURE `isUserValid`(IN `facebookId` VARCHAR(20), IN `userAccessToken` TEXT)
    NO SQL
    COMMENT 'check if user is valid. return true or false'
Begin
    /* declare the select resluts variables*/   
    Declare accessToken TEXT;
    Declare expires datetime;

    /* fill the variables with saved user's access token an expires time*/
    Select Access_Token, Expires
    Into accessToken, expires
    From Users Where Facebook_Id = facebookId;      

    select expires,accessToken;
    /* If the saved access token and expires are valid return true */
    If (BINARY accessToken = userAccessToken And expires > now()) Then
        select true As isUserValid;
    Else
        select false As isUserValid;
    End If; 
End

for some reason the query:

/* fill the variables with saved user's access token an expires time*/
Select Access_Token, Expires
Into accessToken, expires
From Users Where Facebook_Id = facebookId;

return the Expires as null all the time.

When i'm running the same query outside of the procedure - it returns the Expires as a value...

I can't understand what is wrong...

1 Answer 1

1

Ok found it, You must provide different names to variables and fields.

my expires is identical to Expires in the table, therefor it is always null.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.