-
combining result sets
Hi,
I would like to know if mutiple result sets in PL/SQL can be combined into one resultset. These individual result sets will have the same columns coming from the same tables, but from different schemas.
Example code
//Package
CREATE OR REPLACE PACKAGE TEST
AS
TYPE ObjectRC IS REF CURSOR;
FUNCTION SelectData
RETURN ObjectRC;
END TEST;
//Package Body
CREATE OR REPLACE PACKAGE BODY TEST
AS
FUNCTION SelectData
RETURN TEST.ObjectRC
IS
resultsetALL TEST.ObjectRC;
resultset1 TEST.ObjectRC;
resultset2 TEST.ObjectRC;
BEGIN
OPEN resultset1 FOR
SELECT col1,
col2
FROM schema1.Test;
OPEN resultset2 FOR
SELECT col1,
col2
FROM schema2.Test;
resultsetALL := resultset1 + resultset2; ????????????
RETURN resultsetALL;
END SelectData;
END TEST;
In the above example, I need to somehow combine resultset1 and resultset2 and return as one.
Appreciate your help
Reddy
-
Code:
OPEN resultset1 FOR
SELECT col1,
col2
FROM schema1.Test
UNION ALL
SELECT col1,
col2
FROM schema2.Test;
Jeff Hunter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|