| Author |
getting a result set from another stored procedure
|
|
|
|
| species8472 2005-12-30, 11:23 am |
| --- wrote:
> How can I get the result set from calling one stored procedure within another
> stored procedure ?
> ---== Posted via the PFCGuide Web Newsreader ==---
> http://www.mcse.ms/_newsgroups/group_list.asp
have a look at proxy tables
| |
| Frank Rizzo 2006-01-03, 3:23 am |
| species8472 wrote:
> --- wrote:
>
> have a look at proxy tables
I really wish that Sybase would implement the ability to dump the
resultset from the sproc into a temp table. It's just so damn
convinient. Perhaps 15.1?
Regards
| |
| Sherlock, Kevin 2006-01-03, 1:24 pm |
| What's to prevent one from using temp (or permanent) tables to accomplish this?
"Frank Rizzo" <none@none.net> wrote in message news:43ba06ff$1@foru
ms-2-dub...
> species8472 wrote:
>
> I really wish that Sybase would implement the ability to dump the
> resultset from the sproc into a temp table. It's just so damn
> convinient. Perhaps 15.1?
>
> Regards
| |
|
| I suppose I could use a cursor within stored procedure 'A' to call stored
procedure 'B', but the problem I face is that stored procedure 'B' returns a
result set with a variable number of columns.
And I know of no way to account for that within the FETCH statement for the
cursor...unless I modify stored procedure 'B' to always return a fixed number of
columns in the result set.
On 3 Jan 2006 09:58:29 -0800,
in sybase.public.ase.general
Sherlock, Kevin <ksherlock@saionline.com> wrote:
>What's to prevent one from using temp (or permanent) tables to accomplish this?
>
>"Frank Rizzo" <none@none.net> wrote in message news:43ba06ff$1@foru
ms-2-dub...
>
>
| |
| Sherlock, Kevin 2006-01-03, 8:25 pm |
| I'm not sure I understand what you are trying to accomplish. If you want to
call a procedure for each row in a cursor result set, that shouldn't be a
problem.
If you want the results of a stored procedure call stored in a table, then code
the procedure that generates the result set to do so.
You reference a cursor in procedure 'A' below, but then state that a FETCH
statement can't handle a variable number of columns, which makes some reference
to procedure 'B'. Can you clarify a bit more? Maybe some example code?
"---" <---@nowhere.com> wrote in message news:43badff6$1@foru
ms-1-dub...
> I suppose I could use a cursor within stored procedure 'A' to call stored
> procedure 'B', but the problem I face is that stored procedure 'B' returns a
> result set with a variable number of columns.
>
> And I know of no way to account for that within the FETCH statement for the
> cursor...unless I modify stored procedure 'B' to always return a fixed number
of[color=darkred]
> columns in the result set.
>
>
> On 3 Jan 2006 09:58:29 -0800,
> in sybase.public.ase.general
> Sherlock, Kevin <ksherlock@saionline.com> wrote:
this?[color=darkred]
news:43ba06ff$1@foru
ms-2-dub...[color=darkred]
| |
| Frank Rizzo 2006-01-03, 8:25 pm |
| This is what he is trying to do (i think)
create proc Caller()
as
begin
INSERT INTO #temp
EXEC SomeProcA
end
create proc SomeProcA()
as
begin
select * from LargeTable where ColumnX='Y'
end
Sherlock, Kevin wrote:
> I'm not sure I understand what you are trying to accomplish. If you want to
> call a procedure for each row in a cursor result set, that shouldn't be a
> problem.
>
> If you want the results of a stored procedure call stored in a table, then code
> the procedure that generates the result set to do so.
>
> You reference a cursor in procedure 'A' below, but then state that a FETCH
> statement can't handle a variable number of columns, which makes some reference
> to procedure 'B'. Can you clarify a bit more? Maybe some example code?
>
>
> "---" <---@nowhere.com> wrote in message news:43badff6$1@foru
ms-1-dub...
>
>
> of
>
>
> this?
>
>
> news:43ba06ff$1@foru
ms-2-dub...
>
>
>
| |
| Rob Verschoor 2006-01-03, 8:25 pm |
| This has been possible since ASE by creating a proxy table and mapping it to
a stored proc.
HTH,
Rob V.
"Frank Rizzo" <none@none.net> wrote in message
news:43bae33e$1@foru
ms-2-dub...[color=darkred]
> This is what he is trying to do (i think)
>
> create proc Caller()
> as
> begin
>
> INSERT INTO #temp
> EXEC SomeProcA
>
> end
>
>
> create proc SomeProcA()
> as
> begin
> select * from LargeTable where ColumnX='Y'
> end
>
> Sherlock, Kevin wrote:
want to[color=darkred]
a[color=darkred]
then code[color=darkred]
FETCH[color=darkred]
reference[color=dark
red]
stored[color=darkred
]
returns a[color=darkred]
the[color=darkred]
number[color=darkred
]
accomplish[color=dar
kred]
within[color=darkred
]
|
|
|
|