0

I'm used to MSSQL, not MySQL so hopefully this is an obvious fix but I've reviewed a lot of questions on here and manuals etc and can't see why I'm getting this error...

I've written a complex procedure which isn't working; I've isolated the issue to how I'm passing in parameters. I've replicated my issue in a small dummy procedure (below):

DELIMITER//
CREATE PROCEDURE testProcedure(IN startSite CHAR(2), IN endSite CHAR(2))

    SELECT * FROM sys_sites WHERE ssi_uid = startSite;
    SELECT * FROM sys_sites WHERE ssi_uid = endSite;

END
//
DELIMITER;

When I execute this, I get the following error:

CREATE PROCEDURE testProcedure(IN startSite CHAR(2), IN endSite CHAR(2))

SELECT * FROM sys_sites WHERE ssi_uid = startSite; SELECT * FROM sys_sites WHERE ssi_uid = endSite; END

1054 - Unknown column 'endSite' in 'where clause' Time: 0s

Please - can anyone advise what obvious thing I'm missing here?

1 Answer 1

1
DELIMITER//
CREATE PROCEDURE testProcedure(IN startSite CHAR(2), IN endSite CHAR(2))
BEGIN
    SELECT * FROM sys_sites WHERE ssi_uid = startSite;
    SELECT * FROM sys_sites WHERE ssi_uid = endSite;

END
//
DELIMITER;

u missed begin now try and see.

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

2 Comments

Also needs a space between delimiter and the delimiter.
Thank you - I originally wrote with BEGIN and END as I would for MSSQL and removed both, didn't realise when I put the END back in that I forgot the BEGIN! It worked without needing the space between DELIMITER and the delimiter.

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.