Subject | return multiple tables in a dataset |
---|---|
Author | Dixon |
Post date | 2010-05-13T12:21:25Z |
Is it possible to write a procedure that will return multiple result sets in a dataset? If so whats it look like.
here is sample of what I've been trying, but its not working correctly. Instead of getting two separate tables, I get all the
results for field1 and field2 in the same table.
SET TERM ^ ;
CREATE PROCEDURE usp_multipleresults(
IsActive smallint
)
RETURNS (
field1 int
, field2 int
)
as
begin
FOR SELECT field1 from table1 into :field1
DO SUSPEND;
FOR SELECT field2 from table2 into : field2
DO SUSPEND;
end ^
SET TERM ^ ;
here is sample of what I've been trying, but its not working correctly. Instead of getting two separate tables, I get all the
results for field1 and field2 in the same table.
SET TERM ^ ;
CREATE PROCEDURE usp_multipleresults(
IsActive smallint
)
RETURNS (
field1 int
, field2 int
)
as
begin
FOR SELECT field1 from table1 into :field1
DO SUSPEND;
FOR SELECT field2 from table2 into : field2
DO SUSPEND;
end ^
SET TERM ^ ;