The social network for Oracle people
Permalink Reply by Eddie Awad on May 11, 2008 at 3:30pm
Permalink Reply by Ram Kumar on July 24, 2008 at 1:52am
Permalink Reply by Arun Kumar on October 23, 2008 at 10:04pm
Permalink Reply by Rajesh B on September 15, 2012 at 6:40pm Normal Cursor is static and can be associated with only single query where as ref cursor is dynamic and can be associated with multiple queries.
Ref cursor is basically uesd to pass result set to procedure or function which can be used by third party application and can be strong type or weak type.
REF CURSOR - This cursor could be used for processing more than one SELECT query.
NORMAL COUSIR - This cursor could be used for processing only one SELECT query.
Ref Cursor:
ref cursor is a data structure which points to an object which in turn points to the memory location.
ex:
create or replace procedure test()
as
begin
type ref_cursor is ref cursor;
open ref_cursor as
select * from table_name;
end;
There are 2 types in this.
1.strong ref cursor:
This has a return type defined.
2. weak ref cursor.
this doesnt have a return type
normal cursor:
Nothing but the named memory location.
it has 2 types
1. explicit cursor
Need to be defined whenever required.
2.Implicit cursor
need not defined and used by oracle implicitly in DML operation.
hi,
the normal cursor is a static cursor i.e we in the normal cursor the query is only assigned at the design time and it can't be change at the run time.
for e.g
create or replace procedure sp_demo_cursor (squery varchar2)is
cursor c1 is squery;
begin
for v1 in c1 loop
end loop;
end;
assume that there is a requirement that we need to send the query as the parameter of the procedure, in the above case we can't do that. it will give an error.
but the same can be achieved by using the ref cursor.
in other words we can say that ref cursor supports the dynamic change in the cursor.
it also help in memory allocation
hope that above example is helpful and have cleared your doubts.
thanks.
REF CURSOR - This cursor could be used for processing more than one SELECT query.
NORMAL COUSIR - This cursor could be used for processing only one SELECT query.
© 2013 Created by Eddie Awad.