I have a SELECT query that looks similar to the following:

    SELECT
        FirstName,
        LastName
    FROM
        myTable
    WHERE
        LastName IN ('PRICE', 'SMITH');

What I want to do is create a stored procedure for this SELECT query
similar to the following:

    CREATE PROCEDURE spGetNames (IN strNames VARCHAR(255))
    BEGIN
        SELECT
            FirstName,
            LastName
        FROM
            myTable
        WHERE
            LastName IN (strNames);
    END

And then I would like to call it by passing in a list of names.  None of
the following calls work:

        CALL spGetNames ('PRICE,SMITH');
        CALL spGetNames (" 'PRICE', 'SMITH' ");
        CALL spGetNames (" ''PRICE'', ''SMITH'' ");

My question is how to format the string parameter so this query works.

Thanks,

Randall Price
VT.SETI.IAD.MIG:Microsoft Implementation Group
http://vtmig.vt.edu
[EMAIL PROTECTED]

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to