Re: Set of values???

From: DA Morgan <damorgan_at_exesolutions.com>
Date: Sun, 23 Feb 2003 15:44:59 -0800
Message-ID: <3E595CFB.E17BFAF2_at_exesolutions.com>


Damir Dezeljin wrote:

> Hi.
>
> I placed a text item to my form. When a user enter a string there and press
> a certain button I want to execute a query like:
>
> SELECT DISTINCT ids FROM my_table WHERE my_table.something LIKE
> '%<entered_str>%';
>
> The problem of this query is that it returns a lot of <ids>. I want to
> construct an set or array or something similar from those values so that I
> can use them in the below query:
>
> SELECT names FROM my_table2 WHERE my_table.ids IN (<set>);
>
> ...
>
> So I want to use something similar:
> SELECT DISTINCT ids INTO my_set_var
> FROM my_table
> WHERE my_table.something
> LIKE '%<entered_str>%';
>
> in a triger, however I don't know what type have to be my_set_var.
>
> Any idea (posibly an example)?
>
> Regards,
> Dezo

[Quoted] Why not use your first query as a subquery of the second? It would be a lot more efficient and more maintainable than anything involving arrays and I'm not sure I've ever seen an array passed as a parameter to a WHERE clause (though if anyone can post an example I'd be appreciative.).

Daniel Morgan Received on Mon Feb 24 2003 - 00:44:59 CET

Original text of this message