Subject Re: How do it in store procedure
Author GrumpyRain
--- In firebird-support@yahoogroups.com, "m4r3cki" <lukmar4@w...> wrote:
>
> Hello everyone in my first post.
>
> I have database and now I need do a store procedure.
> What it must do?This is beginning of store procedure
> CREATE PROCEDURE DANE_POINT_NUMBER (
> P_NUMBER VARCHAR (25))
> RETURNS (
> ID_USED_CATEGORIES INTEGER,
> NAME_USED_CATEGORIES VARCHAR (16))
> then
> I must find P_Number in one of 25 tables and owing to it I must know
> ID_USED_CATEGORIES and NAME_USED_CATEGORIES. Those parametrs are
> related with another table.
> So,if You can help me I would be so grateful.
> I'm trying use for select...do loop but I am sure that this is the
> best method.

Firstly welcome and I hope your question is answered.

But you are going to have to help us out here. I am not sure what your
stored procedure is trying to accomplish. If my understanding is
correct, you are checking for a field called P_Number in 25 tables
against the value passed in, and then you want to return the
corresponding information for that record.

I can see no reason why only one table may have a given P_number. Are
you expecting multiple records, or is it guaranteed to be unique? If
there are multiple records, do you want all of them to be returned or
just the 'first' one?