Tuesday, February 21, 2012

Returning Multiple Values to a Stored Procedure

Hello,
I would like to call a Stored procedure (B) from another stored
procedure (A). Stored Procedure (B) returns the results of multiple
select statements. Is there a way to handle these multiple results in
the calling stored procedure (A)?
Procedure A
exec B
--after B is called, i want to be able to access the results of the
multiple select statement in procedure B.
Procedure B
Select ...
Select ...
Select ...
Anyone know how to do this'
Thanks,
JamiePerhaps you could use separate cursor output parameters on procedure B
instead of returning them as result sets.
Mike|||If the three selects return similar structure then you can grab the result
into a temporary table, if not, forget it.
AMB
"jamiemcc@.yahoo.com" wrote:

> Hello,
> I would like to call a Stored procedure (B) from another stored
> procedure (A). Stored Procedure (B) returns the results of multiple
> select statements. Is there a way to handle these multiple results in
> the calling stored procedure (A)?
> Procedure A
> exec B
> --after B is called, i want to be able to access the results of the
> multiple select statement in procedure B.
>
> Procedure B
> Select ...
> Select ...
> Select ...
> Anyone know how to do this'
> Thanks,
> Jamie
>|||In addition to AMB's comment, you can only store the resultsets into a temp
table only if your resultsets have the same schema. I.e. each of your
selects returns the same # of columns and the column's datatype is the same.
-oj
<jamiemcc@.yahoo.com> wrote in message
news:1113422951.708703.23390@.f14g2000cwb.googlegroups.com...
> Hello,
> I would like to call a Stored procedure (B) from another stored
> procedure (A). Stored Procedure (B) returns the results of multiple
> select statements. Is there a way to handle these multiple results in
> the calling stored procedure (A)?
> Procedure A
> exec B
> --after B is called, i want to be able to access the results of the
> multiple select statement in procedure B.
>
> Procedure B
> Select ...
> Select ...
> Select ...
> Anyone know how to do this'
> Thanks,
> Jamie
>

No comments:

Post a Comment