Re: create a data block based on a stored procedure?

From: Michael Hsueh <MHsueh_at_Ottawa.com>
Date: 1 May 1999 02:43:14 GMT
Message-ID: <372A69CF.B66DCA99_at_Ottawa.com>


Oracle provides a good example in it's Forms demo.

Here is the relevant info from the build forms demo script. Checkout the demo.

REM Package procedures for block based on stored procedure

create or replace PACKAGE EmpDeptP AS
  type emp_dname is record(
    empno   number(4),
    job  varchar2(9),
    hiredate date,
    deptno  number(2),
    dname  varchar2(14));

  type emp_dname_ref is ref cursor return emp_dname;
  type emp_dname_tab is table of emp_dname index by binary_integer;

  procedure query  (resultset in out emp_dname_ref);

  procedure plock  (dmlset in out emp_dname_tab);
  procedure pinsert(dmlset in out emp_dname_tab);
  procedure pupdate(dmlset in out emp_dname_tab);
  procedure pdelete(dmlset in out emp_dname_tab);
 
END;
/
create or replace PACKAGE BODY EmpDeptP AS

  procedure query(resultset in out emp_dname_ref) is
  begin
    open resultset for
       select e.empno, e.job, e.hiredate, e.deptno, d.dname
       from emp e, dept d
       where e.deptno = d.deptno;
  end;

  procedure plock(dmlset in out emp_dname_tab) is
  begin
--lock the specified record
     null;
  end;

  procedure pinsert(dmlset in out emp_dname_tab) is
  begin
--insert the records from the table of records
     null;
  end;

  procedure pupdate(dmlset in out emp_dname_tab) is
  begin
--update the records from the table of records
     null;
  end;

  procedure pdelete(dmlset in out emp_dname_tab) is
  begin
--delete  the records from the table of records
     null;
  end;
 

END;
/
 

vagelis Hristidis wrote:

I would like to create a data block based on a stored procedure. Do I need
to create a function or a procedure in the database.Do I need to define a
REF CURSOR type first in the database?
Could you tell me the steps that I should follow to create that stored
procedure?
Thanks in advance.

Vagelis

Received on Sat May 01 1999 - 04:43:14 CEST

Original text of this message