Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Declaration of dynamic cursors in PRO*C?
Hay
this is regarding creation of dynamic cursors in pro*c/c++, i have no idea of creating them. i guess cursor declaration is global in scope in C++ program.
i have Class that has member function "Opencursor", this guy opens cursor, i have another member function fetch, which fetched the rows. the problem is , i create a object of above class , i will open a cursoror , i will fetch, while fetching i will crate another object of same class, try to open cursor with new object, and fetch, and close the new object cursor. Once again when i try to fetch the top cursor, i am getting "Fetch out of sequence Error". This is because 'oldcursor' has already been closed in newobject. I can describe it in using psuedo code
Class X
{
public:
opencursor( ); // this opens a cursor using dynamic sql fetchcursor( ); closecuror( ); // closes the same cursor.
};
// my program is like this
main()
{
X obj1, obj2;
obj1 = new X( ); obj1->opencursor(); while ( obj1->fetchcursor() ) { obj2 = new X (); obj2->opencursor(); obj2->fetchcursor(); obj2->closecursor(); // this guy is closing cursor which is opened, in the // in the above, becuase cursor is global scope } // in file } In runtime my obj1->fetch fails, because it's been already by obj2.
I would like to know, whether in dynamic SQL, is there any way to create a cursor names dynamically so that i can have static counter in my class X, which i will use to form new cursor name, and open close it. But i haven't figured it how. may be i can do with, OCI & PRO*C , i am not familiar with OCI calls. i am checking on that, mean while any one can suggest quick solution? i would appriciate help in this regard.
by
suresh vandanapu
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Sat Nov 07 1998 - 00:10:33 CST
![]() |
![]() |