Subject Re: [firebird-support] Stored procedure to return multiple rows in a single string
Author Zd
Hi Milan,

I think you misunderstood me.

Here is what I'm after:

Let's say the user can search by id, name, customfield1, customfield2.

He can choose not to give any parameters (in this case all the rows are shown) or to give some of the parameters. Each parameter that is not null is considered in the query.

Now I could of course create if-s in my stored proc, but as in practise I have more than 4 conditions, there would be too many variations.

Is there a function or way to put a conditional test in the WHERE part of the SELECT?

Like SELECT * FROM MyTable WHERE [if condition1 is not null, then name = condition1] AND [if condition2 is not null, then id = condition2] and so on...

Is this possible?

Thanks:
Zd

----- Original Message -----
From: Milan Babuskov
To: firebird-support@yahoogroups.com
Sent: Wednesday, February 27, 2008 9:42 AM
Subject: Re: [firebird-support] Stored procedure to return multiple rows in a single string


Zd wrote:
> Now just another short question:
> If I were to execute a user defined search in a stored procedure, what would be the best way to achieve this?

Using EXECUTE STATEMENT

--
Milan Babuskov
http://www.flamerobin.org




[Non-text portions of this message have been removed]