Subject Re: [ib-support] Working with arrays
Author Dimitry Sibiryakov
On 7 Sep 2002 at 21:37, Jaume Andreu Sabater Malondra wrote:

>The stored procedure that does the work of deleting those rows,
>receives a varchar(255) with a list of comma separated integer values,
>in the form of "1,2,3" and so on. Let's call the parameter P_LIST.
>
>So, the only solutions it seems I have is to use DSQL to dynamically
>handle the comma sepparated values and add "AND (FIELD_B <> XX)"
>clausules to the statement. Then execute it.

Constructing DSQL statement on the client side (as a matter of fact
you can't use DSQL anywhere else), you can use NOT IN (<list of
values>).

>Any hints on this? Is there any way to work with arrays or should I
>just forget about arrays and try the DSQL way?

If you really have to do this inside of stored proc, try this:

DELETE FROM TABLE
WHERE (FIELD_A = :P_PARAM)
AND (','||P_LIST||',' NOT LIKE '%,'||CAST(FIELD_B AS VarChar)||',%');

If you add extra commas to P_LIST beforehand, you can make this
expression a bit simpler.

SY, Dimitry Sibiryakov.