473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Open twice (or more) the same cursor

Hi, I have a recursive table "Objectnew" with the columns "objectref"
(primary key), objectname, objectid, and parentobjectid
Recursive Relation: objectid ----< Parentobjectid

I have the following cursor that extracts information about all
objects with a specific name below a starting point

DECLARE
CURSOR findChildren(
starting Objectnew.objectref%TYPE,
name Objectnew.objectname%TYPE) IS
SELECT
objectref,
objectname
FROM
Objectnew
WHERE
objectref in (
SELECT
objectref
FROM
Objectnew
CONNECT BY PRIOR objectid = parentobjectid
START WITH objectref = startingref
) AND
objectname = name;

What I need is, once I found some objects with a specific name, to run
another query below each of them to find objects with another name.

Something like
OPEN findChildren(1234, 'A');
LOOP
FETCH findChildren INTO ref, name
EXIT WHEN findChildren%NOTFOUND;

-- I have found an object A,
-- I need to know if there is a B below A
OPEN findChildren(ref, 'B');
LOOP
FETCH findChildren INTO ref2, name2
EXIT WHEN findChildren%NOTFOUND;

-- YES, there is a B, process it
....
Is it possible without creating a duplicate of cursor findChildren ?
Thank you
Bernard Drolet
Jul 19 '05 #1
1 16809
the cursor can only be opened once, but you could do a recursive procedure
call, ie.:

declare
procedure findC (...
cursor cFindC ...
is
...
-- found record, recursive call
findC(...);
...
end;
begin
-- initial call
findC(...);
end;

(or create the recursively called procedure as a stored procedure)
--
Mark C. Stock
email mcstock -> enquery(dot)com
www.enquery.com
(888) 512-2048

"Bernard Drolet" <be*****@drolet.com> wrote in message
news:a9**************************@posting.google.c om...
Hi, I have a recursive table "Objectnew" with the columns "objectref"
(primary key), objectname, objectid, and parentobjectid
Recursive Relation: objectid ----< Parentobjectid

I have the following cursor that extracts information about all
objects with a specific name below a starting point

DECLARE
CURSOR findChildren(
starting Objectnew.objectref%TYPE,
name Objectnew.objectname%TYPE) IS
SELECT
objectref,
objectname
FROM
Objectnew
WHERE
objectref in (
SELECT
objectref
FROM
Objectnew
CONNECT BY PRIOR objectid = parentobjectid
START WITH objectref = startingref
) AND
objectname = name;

What I need is, once I found some objects with a specific name, to run
another query below each of them to find objects with another name.

Something like
OPEN findChildren(1234, 'A');
LOOP
FETCH findChildren INTO ref, name
EXIT WHEN findChildren%NOTFOUND;

-- I have found an object A,
-- I need to know if there is a B below A
OPEN findChildren(ref, 'B');
LOOP
FETCH findChildren INTO ref2, name2
EXIT WHEN findChildren%NOTFOUND;

-- YES, there is a B, process it
...
Is it possible without creating a duplicate of cursor findChildren ?
Thank you
Bernard Drolet

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michal Adamski | last post by:
I'm trying to make a popup. The code I pasted below works, but my problem is, that I want the http://www.mypage.com to open in the same browser window. So I need something instead of window.open()....
5
by: gil | last post by:
I have a form that I would like to get the values entered on the page and go to a new page in the same window. I can make the code work to open a new window, but I need it to open in the same...
6
by: Debbie Gilbert | last post by:
When running a report..I get the message "Cannot open any more databases." Run-time error 3048... Has anyone seen this message before?
4
by: Koen | last post by:
Hi all, At work I created a database which is really helpful. The database is used by approx 15 users. Everything worked great, until I added some 'scoreboard' forms and reports. I get the...
1
by: Niranjan | last post by:
I have a relatively straight forward report. The query that populates data for this report is complicated. The report opens without any problem and I can print it as well. However, If I have...
1
by: Phil Stanton | last post by:
Real problem usink AK2 I have got a form with 7 tabs on it, numerous subforms and combo boxes. as well as continuous subforms with combo boxes. I get the message "Can't open any more databases"...
1
by: celtic_kiwi | last post by:
I have an Access 97 database, quite large, and have started getting the error, Error 3048: Can't Open any more databases. -The data is split from the application (front end and back end). -The...
2
by: celtic_kiwi | last post by:
I have an Access 97 database, quite large, and have started getting the error, Error 3048: Can't Open any more databases. -The data is split from the application (front end and back end). -The...
2
n8kindt
by: n8kindt | last post by:
i'm stuck. i'm using access 2007 on a windows vista machine (i've tried running on xp too, though--same result) and this is the error i keep getting whenever i try running my main query: Cannot...
9
by: vanlanjl | last post by:
Okay lets see if I can do this with out confusing myself or others. First I will give ALL the details then state my problem and request at the bottom. Tables: tblContacts ID Company LastName...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.