Skip to Main Content
  • Questions
  • How to create a block on a procedure in forms.

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Amitabha .

Asked: May 02, 2000 - 1:21 pm UTC

Last updated: June 11, 2006 - 11:54 am UTC

Version:

Viewed 1000+ times

You Asked

I have been using forms 6.0.5.29.4
I wanted to develop a screen based on a procedure
I followed all the steps described in the help file.

Created a package

Follwed the steps described in
"Creating a data block from a
procedure that uses a ref cursor"

When I try to run the new fmb the .fmx file is being created but
nothing is coming on the screen
What may be going wrong?
I am trying this for the first time,
we are going to develop something
based on procedures to improve performance of some of our query
only screens.

Can you send me a very simple sample of how to do this?



and Tom said...



the step by step I just did was:

1) created the following package in the database:

create or replace package demo_pkg
as
type refcur is ref cursor return emp%rowtype;

procedure get_emp_data( p_cursor in out refcur );
end;
/

create or replace package body demo_pkg
as

procedure get_emp_data( p_cursor in out refcur )
is
begin
open p_cursor for select * from emp;
end;


end;
/

2) using the data block wizard I entered

o build on stored procedure
o entered demo_pkg.get_emp_data and selected ALL of the columns it showed me.
o left the insert/update/delete/lock procedures empty
o finished and went into the layout wizard.
o selected all columns for layout
o chose tabular
o set records to display to 4
o and finished

then I ran the form, hit F8 and the data was all there.



That was it.



Rating

  (3 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

insert/update/delete/lock procedures

Bai, October 30, 2001 - 10:49 am UTC

Hi Tom,

is there any examples about insert/update/delete/lock procedures, if we don't let them to be empty?

Client side

Famy, February 24, 2003 - 2:14 pm UTC

Instead of creating the package in the database, can I create it at the client i.e. as a forms package and base my block on it.

I tried to do that , and I'm getting the error that 'forms is unable to query'

Tom Kyte
February 24, 2003 - 2:25 pm UTC

the ref cursor needs to come FROM the database. it isn't a client side thing.

How to implement this?

A reader, June 11, 2006 - 1:22 am UTC

Hello,

How can I implement a package like this in forms? I mean how can I pass paramenter value to this package at runtime?

create or replace package demo_pkg
as
type refcur is ref cursor return emp%rowtype;

procedure get_emp_data( p_empno in emp.empno%type, p_cursor in out refcur );
end;
/

create or replace package body demo_pkg
as

procedure get_emp_data( p_empno in emp.empno%type, p_cursor in out refcur )
is
begin
open p_cursor for select * from emp where empno = p_empno;
end;


end;
/


Tom Kyte
June 11, 2006 - 11:54 am UTC

I haven't touched forms since March 1995.

You would be best served by using the forums on otn.oracle.com to ask about forms related questions.


But that package would compile into the database just fine.

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library