This is a discussion on How to create a dynamic cursor? within the Oracle Database forums, part of the Database Server Software category; --> How do i do a dynamic cursor? I know how to use Execute Immediate and do a select into, ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| How do i do a dynamic cursor? I know how to use Execute Immediate and do a select into, but how do I do it with an explicit cursor? Also, anyone know which book explains it? Checked the Fuerstein book and the OTN PL/SQL doc and couldnt find it. Could I do it with a REF cursor? |
| |||
| DA Morgan <damorgan@exesolutions.com> wrote in message news:<3E149FA0.CB96646B@exesolutions.com>... > Ryan Gaffuri wrote: > > > How do i do a dynamic cursor? I know how to use Execute Immediate and > > do a select into, but how do I do it with an explicit cursor? > > > > Also, anyone know which book explains it? Checked the Fuerstein book > > and the OTN PL/SQL doc and couldnt find it. > > > > Could I do it with a REF cursor? > > I've no doubt you are confused as your posting is confusing to me. > > Rather than throwing around dynamic/explicit/ref cursor ... why not just > tell us what you are trying to do. > > It would make it much easier to help you. > > Daniel Morgan Not sure how else to explain. I do not know what table or my column names until run time. I have to pass in variables. For example Execute Immediate 'Select :1 ' || ' From :2 '; using foo, foo1 into var1, var2; This is a dynamic implicit cursor. I need to do an explicit version of it. declare CURSOR cur_cursor is ' Select :1 ' || ' From :2 '; open cur_cursor; loop fetch cur_cursor into rec_cursor; exit when cur_cursor%notfound; end loop; how do i do that? Where is the documentation on this? Can I do this kind of thing with a REF cursor and without using DBMS_SQL? This is just pseudo-code, so dont worry about the minor syntax errors. |
| ||||
| DA Morgan <damorgan@exesolutions.com> wrote in message news:<3E149FA0.CB96646B@exesolutions.com>... > Ryan Gaffuri wrote: > > > How do i do a dynamic cursor? I know how to use Execute Immediate and > > do a select into, but how do I do it with an explicit cursor? > > > > Also, anyone know which book explains it? Checked the Fuerstein book > > and the OTN PL/SQL doc and couldnt find it. > > > > Could I do it with a REF cursor? > > I've no doubt you are confused as your posting is confusing to me. > > Rather than throwing around dynamic/explicit/ref cursor ... why not just > tell us what you are trying to do. > > It would make it much easier to help you. > > Daniel Morgan Sorry to have bothered you. I found my metalink account and dug it up there. Sorry, couldnt find my login so asked here. I used a REF cursor to do it. |