Cursor in EXECUTE IMMEDIATE

Sometimes you want to use cursor without Open Cursor,you can use ref cursor .

syntax :

declare
   SQL_Text varchar2(32760) := 'qurey'; --your query goes here
   cur sys_refcursor;
begin
   open cur for SQL_Text;
end;
 

example :
V_query := 'Cursor statement' ;

declare
  rc sys_refcursor;
begin
  open rc for ;
  loop
    fetch rc into variable;
    exit when rc%notfound;
    <do your process.>
  end loop;
  close rc;
end;
Link Useful :
1-Blog
2-Cursor Loop Example 

Enjoy

Osama mustafa

Comments

Popular posts from this blog

Connection refused; No available router to destination On Weblogic Node Manager Log

How to change SGA in Oracle Rac

SGA_MAX_SIZE & SGA_TARGET / MEMORY_TARGET & MEMORY_MAX_TARGET