hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry Tolpeko (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-11290) Cursor attributes %ISOPEN, %FOUND, %NOTFOUND and SYS_REFCURSOR variable
Date Tue, 21 Jul 2015 14:20:05 GMT

    [ https://issues.apache.org/jira/browse/HIVE-11290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14635172#comment-14635172
] 

Dmitry Tolpeko commented on HIVE-11290:
---------------------------------------

An example:

{code}
CREATE PROCEDURE spResultSet1 (cur OUT SYS_REFCURSOR)
BEGIN
  OPEN cur FOR SELECT 'A' FROM src LIMIT 1;
END;
{code}

Then it can be used as follows:

{code}
DECLARE 
  c1 SYS_REFCURSOR;
  v1 VARCHAR(30);
BEGIN
  CALL spResultSet1(c1);

  IF c1%ISOPEN THEN
    DBMS_OUTPUT.PUT_LINE('Cursor open');
  END IF; 
  
  FETCH c1 INTO v1;
  
  IF c1%FOUND THEN
    DBMS_OUTPUT.PUT_LINE('Row found');
  END IF;
  
  FETCH c1 INTO v1;

  IF c1%NOTFOUND THEN
    DBMS_OUTPUT.PUT_LINE('Row not found');
  END IF;  

  CLOSE c1; 
END;
{code}

> Cursor attributes %ISOPEN, %FOUND, %NOTFOUND and SYS_REFCURSOR variable
> -----------------------------------------------------------------------
>
>                 Key: HIVE-11290
>                 URL: https://issues.apache.org/jira/browse/HIVE-11290
>             Project: Hive
>          Issue Type: Improvement
>          Components: hpl/sql
>            Reporter: Dmitry Tolpeko
>            Assignee: Dmitry Tolpeko
>
> Cursor attributes allow you to get information about the current cursor state. Cursor
variable can be used to pass result sets between routines.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message