Subject | Re: Sharing a cursor with recursive calls |
---|---|
Author | redtneen |
Post date | 2007-08-16T13:58:34Z |
create procedure "procGetTree" ("vParent" integer)
returns ("ID" integer)
as
declare variable "aID" integer;
begin
if ("vParent" <> 0) then
begin
"ID" = "vParent";
suspend;
end
for
select "ID" from "SomeTable"
where "Parent"= :"vParent"
order by "Parent","Name" --u need index on these fields
into :"aID"
do
begin
for
select "ID" from "procGetTree" (:"aID")
into :"aID"
do
begin
"ID" = "aID";
suspend;
end
end
end
if this code didn't help u can u show me what kind of statement u
trying do do?
this code is tested and it's very fast
returns ("ID" integer)
as
declare variable "aID" integer;
begin
if ("vParent" <> 0) then
begin
"ID" = "vParent";
suspend;
end
for
select "ID" from "SomeTable"
where "Parent"= :"vParent"
order by "Parent","Name" --u need index on these fields
into :"aID"
do
begin
for
select "ID" from "procGetTree" (:"aID")
into :"aID"
do
begin
"ID" = "aID";
suspend;
end
end
end
if this code didn't help u can u show me what kind of statement u
trying do do?
this code is tested and it's very fast