Subject Re: another select in optimisation
Author Svein Erling Tysvær
Hi Henry!

I saw your mail yesterday, but didn't answer since I never use stored procedures
this way and do not know the answer. But a wild guess that may not work is
hopefully better than no answer at all...

Try

select T.TEL from T_PROSP T
join StoredProc('A','B','C')) SP
on SP.ANUM = T.NUM

I have no idea whether it will work or not, but if not, then hopefully others
will include a solution amongst all their complaints that things cannot be done
this way ;o}

Of course, if both T.ANUM and SP.ANUM may return duplicate values, you may end
up with getting TEL returned too few or too many times (if none or only one of
them return duplicates, it at worst is a problem easily circumvented).

HTH,
Set

--- In firebird-support@yahoogroups.com, "henry FRANQUET" wrote:
> Hi
>
> I have a query
> select TEL from T_PROSP
> where NUM in (select ANUM from StoredProc('A','B','C'))
>
> StoredProc is a procedure with an execute statement
>
> when using select ANUM from StoredProc('A','B','C')) it is done in 0.
> 03 second, with the query above it takes several minutes (I abort
> before end !)
>
> it seems that Firebird execute the stored proc for each value in
> T_PROSP
>
> Is there a way to instruct Firebird that the 2 select statement are
> independant ?