Is it possible to use a GROUP\_CONCAT in a SELECT as the input of a MySQL function? I cannot figure out how to cast the variable it seems. I've tried blob. I've tried text (then using another function to break it up into a result set, [here](http://ondra.zizka.cz/stranky/programovani/sql/mysql_stored_procedures.texy#String_functions)) but I haven't had any success.

I want to use it like this:

```
SELECT 
newCustomerCount(GROUP_CONCAT(DISTINCT items.invoicenumber)) AS new_customers
FROM items;

```

Here is the function:

```
DROP FUNCTION IF EXISTS newCustomerCount;
DELIMITER $$
CREATE FUNCTION newCustomerCount(invoicenumbers BLOB)
  RETURNS INT
  DETERMINISTIC
BEGIN
    DECLARE new_customers INT;
    SET new_customers = 0;

    SELECT 
        SUM(nc.record) INTO new_customers
    FROM (
        SELECT
        1 AS customer,
        (SELECT COUNT(*) FROM person_to_invoice ps2 WHERE person_id = ps1.person_id AND invoice < ps1.invoice) AS previous_invoices
        FROM person_to_invoice ps1
        WHERE invoice IN(invoicenumbers)
        HAVING previous_invoices = 0
    ) nc;

    RETURN new_customers;

END$$
DELIMITER ;

```