Subject RE: [firebird-support] Table name as parameter to stored procedure ?
Author Ionut Ichim
The same database is used by 2 distinct application that have only some tables in common.So,in aplication 1 user must select from a combo year and month and the same thing in application 2 but from other table.So I use one SP for both.


sasha <selectnull@...> wrote: >
> Thanks Sasha, your sugestion with EXECUTE STATEMENT solved my problem.
> Thanks also to Martijn Tonies.
>
> var_sttm='SELECT DISTINCT year,month FROM '||:pTBL
>
> FOR EXECUTE STATEMENT var_sttm INTO :year,:month DO BEGIN
> SUSPEND; END END;
>

You're welcome.
I'm curious though, why do you need distinct month, year from unknown table?
If you have a couple of tables that have similar structure (month and year
columns) you could create a view and union all tables involved. I think it
should perform faster than executing statements in psql.

Sasha






---------------------------------
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search.

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