Subject | Re: How can be stored procedure used in a SELECT |
---|---|
Author | Alexander V.Nevsky |
Post date | 2004-05-26T15:58:43Z |
--- In firebird-support@yahoogroups.com, "kimon_the_athenian2"
<kimon_the_athenian2@y...> wrote:
select t.id,
sp.some_calculation,
sp.related_calculation,
sp.yet_another_calculation
from sometable t LEFT join somesp sp(t.id) on 0=0
note inner join will not work. No problem with inner joins and no need
trick with empty condition when SP is "leading" object, like
Select t.id,
sp.some_calculation,
sp.related_calculation,
sp.yet_another_calculation
from somesp sp(:param) join sometable t on t.id=sp.something
Best regards,
Alexander
<kimon_the_athenian2@y...> wrote:
> > one row at most AND it is a selectable SP then you could use aThe only known way is
> correlated
> > subquery, viz.
>
> Thanks for quick response!
>
> Actually, I'm using currently my sp-s like this. I just wasn't sure
> if this is the correct way.
>
> The thing that concerns me, is unnecessary preformance loss when
> querying several output parameters from the same SP. When I use:
>
> select
> t.id,
> (select some_calculation from sp(t.id)) as x,
> (select related_calculation from sp(t.id)) as y
> (select yet_another_calculation from sp(t.id)) as z
> from sometable t
select t.id,
sp.some_calculation,
sp.related_calculation,
sp.yet_another_calculation
from sometable t LEFT join somesp sp(t.id) on 0=0
note inner join will not work. No problem with inner joins and no need
trick with empty condition when SP is "leading" object, like
Select t.id,
sp.some_calculation,
sp.related_calculation,
sp.yet_another_calculation
from somesp sp(:param) join sometable t on t.id=sp.something
Best regards,
Alexander