dbTalk Databases Forums  

Cursors

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Cursors in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
amerar@iwc.net
 
Posts: n/a

Default Cursors - 01-07-2008 , 01:07 PM







Hi All,

I've looked over some internet pages and have not found the solution
yet.....

I have a cursor which is the same in terms of columns for 5 tables,
except the table name is different. Can I create some type of REF
cursor or something where I can change the table name so I can use the
same select?

Not sure if this can be a cursor parameter......

Not my design, so I cannot combine the tables......

Thanks!!

Reply With Quote
  #2  
Old   
fitzjarrell@cox.net
 
Posts: n/a

Default Re: Cursors - 01-07-2008 , 04:17 PM






On Jan 7, 1:07*pm, "ame... (AT) iwc (DOT) net" <ame... (AT) iwc (DOT) net> wrote:
Quote:
Hi All,

I've looked over some internet pages and have not found the solution
yet.....

I have a cursor which is the same in terms of columns for 5 tables,
except the table name is different. *Can I create some type of REF
cursor or something where I can change the table name so I can use the
same select?

Not sure if this can be a cursor parameter......

Not my design, so I cannot combine the tables......

Thanks!!
A REF CURSOR is used for passing the output of a select statement to
another process:

declare
type mycur is ref cursor;
myrefcursor mycur;
begin
open myrefcursor for select * from user_objects;
end;
/

You COULD build a query string and substitute the table_name:

declare
type mycur is ref cursor;
myrefcursor mycur;
cursor get_tabname is
select table_name from user_tables;
begin
for tabname in get_tabname loop
open myrefcursor for 'select * from '||
tabname.table_name||' where 0=1';
end loop;
end;
/

And possibly that's what you're wanting.


David Fitzjarrell


Reply With Quote
  #3  
Old   
fitzjarrell@cox.net
 
Posts: n/a

Default Re: Cursors - 01-07-2008 , 04:17 PM



On Jan 7, 1:07*pm, "ame... (AT) iwc (DOT) net" <ame... (AT) iwc (DOT) net> wrote:
Quote:
Hi All,

I've looked over some internet pages and have not found the solution
yet.....

I have a cursor which is the same in terms of columns for 5 tables,
except the table name is different. *Can I create some type of REF
cursor or something where I can change the table name so I can use the
same select?

Not sure if this can be a cursor parameter......

Not my design, so I cannot combine the tables......

Thanks!!
A REF CURSOR is used for passing the output of a select statement to
another process:

declare
type mycur is ref cursor;
myrefcursor mycur;
begin
open myrefcursor for select * from user_objects;
end;
/

You COULD build a query string and substitute the table_name:

declare
type mycur is ref cursor;
myrefcursor mycur;
cursor get_tabname is
select table_name from user_tables;
begin
for tabname in get_tabname loop
open myrefcursor for 'select * from '||
tabname.table_name||' where 0=1';
end loop;
end;
/

And possibly that's what you're wanting.


David Fitzjarrell


Reply With Quote
  #4  
Old   
fitzjarrell@cox.net
 
Posts: n/a

Default Re: Cursors - 01-07-2008 , 04:17 PM



On Jan 7, 1:07*pm, "ame... (AT) iwc (DOT) net" <ame... (AT) iwc (DOT) net> wrote:
Quote:
Hi All,

I've looked over some internet pages and have not found the solution
yet.....

I have a cursor which is the same in terms of columns for 5 tables,
except the table name is different. *Can I create some type of REF
cursor or something where I can change the table name so I can use the
same select?

Not sure if this can be a cursor parameter......

Not my design, so I cannot combine the tables......

Thanks!!
A REF CURSOR is used for passing the output of a select statement to
another process:

declare
type mycur is ref cursor;
myrefcursor mycur;
begin
open myrefcursor for select * from user_objects;
end;
/

You COULD build a query string and substitute the table_name:

declare
type mycur is ref cursor;
myrefcursor mycur;
cursor get_tabname is
select table_name from user_tables;
begin
for tabname in get_tabname loop
open myrefcursor for 'select * from '||
tabname.table_name||' where 0=1';
end loop;
end;
/

And possibly that's what you're wanting.


David Fitzjarrell


Reply With Quote
  #5  
Old   
fitzjarrell@cox.net
 
Posts: n/a

Default Re: Cursors - 01-07-2008 , 04:17 PM



On Jan 7, 1:07*pm, "ame... (AT) iwc (DOT) net" <ame... (AT) iwc (DOT) net> wrote:
Quote:
Hi All,

I've looked over some internet pages and have not found the solution
yet.....

I have a cursor which is the same in terms of columns for 5 tables,
except the table name is different. *Can I create some type of REF
cursor or something where I can change the table name so I can use the
same select?

Not sure if this can be a cursor parameter......

Not my design, so I cannot combine the tables......

Thanks!!
A REF CURSOR is used for passing the output of a select statement to
another process:

declare
type mycur is ref cursor;
myrefcursor mycur;
begin
open myrefcursor for select * from user_objects;
end;
/

You COULD build a query string and substitute the table_name:

declare
type mycur is ref cursor;
myrefcursor mycur;
cursor get_tabname is
select table_name from user_tables;
begin
for tabname in get_tabname loop
open myrefcursor for 'select * from '||
tabname.table_name||' where 0=1';
end loop;
end;
/

And possibly that's what you're wanting.


David Fitzjarrell


Reply With Quote
  #6  
Old   
amerar@iwc.net
 
Posts: n/a

Default Re: Cursors - 01-07-2008 , 04:21 PM



On Jan 7, 4:17*pm, "fitzjarr... (AT) cox (DOT) net" <fitzjarr... (AT) cox (DOT) net> wrote:
Quote:
On Jan 7, 1:07*pm, "ame... (AT) iwc (DOT) net" <ame... (AT) iwc (DOT) net> wrote:

Hi All,

I've looked over some internet pages and have not found the solution
yet.....

I have a cursor which is the same in terms of columns for 5 tables,
except the table name is different. *Can I create some type of REF
cursor or something where I can change the table name so I can use the
same select?

Not sure if this can be a cursor parameter......

Not my design, so I cannot combine the tables......

Thanks!!

A REF CURSOR is used for passing the output of a select statement to
another process:

declare
* *type mycur is ref cursor;
* *myrefcursor mycur;
begin
* *open myrefcursor for select * from user_objects;
end;
/

You COULD build a query string and substitute the table_name:

declare
* *type mycur is ref cursor;
* *myrefcursor mycur;
* *cursor get_tabname is
* *select table_name from user_tables;
begin
* *for tabname in get_tabname loop
* * * * * *open myrefcursor for 'select * from '||
tabname.table_name||' where 0=1';
* *end loop;
end;
/

And possibly that's what you're wanting.

David Fitzjarrell

Got it done. Thanks!



Reply With Quote
  #7  
Old   
amerar@iwc.net
 
Posts: n/a

Default Re: Cursors - 01-07-2008 , 04:21 PM



On Jan 7, 4:17*pm, "fitzjarr... (AT) cox (DOT) net" <fitzjarr... (AT) cox (DOT) net> wrote:
Quote:
On Jan 7, 1:07*pm, "ame... (AT) iwc (DOT) net" <ame... (AT) iwc (DOT) net> wrote:

Hi All,

I've looked over some internet pages and have not found the solution
yet.....

I have a cursor which is the same in terms of columns for 5 tables,
except the table name is different. *Can I create some type of REF
cursor or something where I can change the table name so I can use the
same select?

Not sure if this can be a cursor parameter......

Not my design, so I cannot combine the tables......

Thanks!!

A REF CURSOR is used for passing the output of a select statement to
another process:

declare
* *type mycur is ref cursor;
* *myrefcursor mycur;
begin
* *open myrefcursor for select * from user_objects;
end;
/

You COULD build a query string and substitute the table_name:

declare
* *type mycur is ref cursor;
* *myrefcursor mycur;
* *cursor get_tabname is
* *select table_name from user_tables;
begin
* *for tabname in get_tabname loop
* * * * * *open myrefcursor for 'select * from '||
tabname.table_name||' where 0=1';
* *end loop;
end;
/

And possibly that's what you're wanting.

David Fitzjarrell

Got it done. Thanks!



Reply With Quote
  #8  
Old   
amerar@iwc.net
 
Posts: n/a

Default Re: Cursors - 01-07-2008 , 04:21 PM



On Jan 7, 4:17*pm, "fitzjarr... (AT) cox (DOT) net" <fitzjarr... (AT) cox (DOT) net> wrote:
Quote:
On Jan 7, 1:07*pm, "ame... (AT) iwc (DOT) net" <ame... (AT) iwc (DOT) net> wrote:

Hi All,

I've looked over some internet pages and have not found the solution
yet.....

I have a cursor which is the same in terms of columns for 5 tables,
except the table name is different. *Can I create some type of REF
cursor or something where I can change the table name so I can use the
same select?

Not sure if this can be a cursor parameter......

Not my design, so I cannot combine the tables......

Thanks!!

A REF CURSOR is used for passing the output of a select statement to
another process:

declare
* *type mycur is ref cursor;
* *myrefcursor mycur;
begin
* *open myrefcursor for select * from user_objects;
end;
/

You COULD build a query string and substitute the table_name:

declare
* *type mycur is ref cursor;
* *myrefcursor mycur;
* *cursor get_tabname is
* *select table_name from user_tables;
begin
* *for tabname in get_tabname loop
* * * * * *open myrefcursor for 'select * from '||
tabname.table_name||' where 0=1';
* *end loop;
end;
/

And possibly that's what you're wanting.

David Fitzjarrell

Got it done. Thanks!



Reply With Quote
  #9  
Old   
amerar@iwc.net
 
Posts: n/a

Default Re: Cursors - 01-07-2008 , 04:21 PM



On Jan 7, 4:17*pm, "fitzjarr... (AT) cox (DOT) net" <fitzjarr... (AT) cox (DOT) net> wrote:
Quote:
On Jan 7, 1:07*pm, "ame... (AT) iwc (DOT) net" <ame... (AT) iwc (DOT) net> wrote:

Hi All,

I've looked over some internet pages and have not found the solution
yet.....

I have a cursor which is the same in terms of columns for 5 tables,
except the table name is different. *Can I create some type of REF
cursor or something where I can change the table name so I can use the
same select?

Not sure if this can be a cursor parameter......

Not my design, so I cannot combine the tables......

Thanks!!

A REF CURSOR is used for passing the output of a select statement to
another process:

declare
* *type mycur is ref cursor;
* *myrefcursor mycur;
begin
* *open myrefcursor for select * from user_objects;
end;
/

You COULD build a query string and substitute the table_name:

declare
* *type mycur is ref cursor;
* *myrefcursor mycur;
* *cursor get_tabname is
* *select table_name from user_tables;
begin
* *for tabname in get_tabname loop
* * * * * *open myrefcursor for 'select * from '||
tabname.table_name||' where 0=1';
* *end loop;
end;
/

And possibly that's what you're wanting.

David Fitzjarrell

Got it done. Thanks!



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.