[
https://issues.apache.org/jira/browse/HIVE-11254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14626485#comment-14626485
]
Dmitry Tolpeko commented on HIVE-11254:
---------------------------------------
An example of a stored procedure returning a result set (DB2, Teradata syntax):
{code}
CREATE PROCEDURE spResultSet1
DYNAMIC RESULT SETS 1
BEGIN
DECLARE cur1 CURSOR WITH RETURN FOR
SELECT 'A', 'A1' FROM src LIMIT 3;
OPEN cur1;
END;
{code}
Then this procedure can be called and results fetched as follows:
{code}
DECLARE v1 VARCHAR(10);
DECLARE v2 VARCHAR(10);
CALL spResultSet1;
ALLOCATE c1 CURSOR FOR PROCEDURE spResultSet1; -- Teradata syntax
FETCH c1 INTO v1, v2;
WHILE (SQLCODE = 0)
DO
-- ...
FETCH c1 INTO v1, v2;
END WHILE;
CLOSE c1;
{code}
> Process result sets returned by a stored procedure
> --------------------------------------------------
>
> Key: HIVE-11254
> URL: https://issues.apache.org/jira/browse/HIVE-11254
> Project: Hive
> Issue Type: Improvement
> Components: hpl/sql
> Reporter: Dmitry Tolpeko
> Assignee: Dmitry Tolpeko
>
> Stored procedure can return one or more result sets. A caller should be able
> to process them.
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)