A script-enabled browser is required for this page to function properly.

Creating a Data Block from a Procedure that Uses a Ref Cursor

To create a data block from a procedure that uses a ref cursor:

  1. In the Object Navigator, click the Data Blocks node.
  2. Click Create in the toolbar.
  3. In the New Data Block dialog box, choose Build a New Data Block Manually and click OK.
  4. Double-click the Block object icon to display the Property Palette.
  5. Under the Database node:
  6. Under the General node, click the Name property, then type a name or accept the default name.  You can use any name that follows ORACLE naming conventions and is unique among blocks in the form. The block name is an internal descriptor that is not displayed at runtime.

Creating a data block from a procedure that uses a ref cursor Restrictions

Creating a data block from a procedure that uses a ref cursor Examples

This example is a stored procedure that returns a ref cursor as a block datasource. A package is used to logically group the related data types and procedures.

PACKAGE cv_datasource IS
TYPE emprec is RECORD (empno emp.empno%TYPE,
ename emp.ename%TYPE,
job emp.job%TYPE,
mgr emp.mgr%TYPE,
sal emp.sal%TYPE,
comm emp.comm%TYPE,
deptno emp.deptno%TYPE);
TYPE empcur is REF CURSOR RETURN emprec;
PROCEDURE empquery(resultset IN OUT empcur,
p_deptno IN NUMBER);
END;


PACKAGE BODY cv_datasource IS
PROCEDURE empquery(resultset IN OUT empcur,
p_deptno IN NUMBER) IS;
BEGIN
OPEN resultset FOR
SELECT empno, ename, job, mgr, sal, comm, deptno
FROM emp
WHERE deptno = p_deptno
ORDER BY empno;
END;
END;