From: | "Eric Peters" <eric(at)peters(dot)org> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | can you do a for loop on a function call in PL/PGSQL? |
Date: | 2002-02-18 19:07:41 |
Message-ID: | 00bb01c1b8af$8c6ce960$4500a8c0@er1c |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Basically what I'm trying to do is:
FOR zone_dns_r3 IN zone_dns_from_zone_dns_id(zone_dns_r.zone_dns_id,
zone_dns_r2.zone_dns_id)
LOOP
RETURN (zone_dns_r3) AND RESUME;
END LOOP;
Where I want to loop the results from a stored procedure (I happen to be
calling it recusively)
NOTICE: plpgsql: ERROR during compile of get_zone_dns_from_zone_dns_id near
line 29
ERROR: parse error at or near "get_zone_dns_from_zone_dns_id"
Is basically what its having problems with "the zone_dns_from_zone_dns_id("
call
Any ideas?
My full stored procedure:
CREATE FUNCTION get_zone_dns_from_zone_dns_id(INTEGER, INTEGER) RETURNS
setof zone_dns AS '
DECLARE
zone_dns_parent_id_param ALIAS FOR $1;
zone_dns_id_param ALIAS FOR $2;
zone_dns_r zone_dns%ROWTYPE;
zone_dns_r2 zone_dns%ROWTYPE;
zone_dns_r3 zone_dns%ROWTYPE;
BEGIN
FOR zone_dns_r IN
select
zone_dns.*
from
zone_dns
where
zone.zone_dns_id = zone_dns_id_param AND
zone_dns.zone_dns_parent_id = zone_dns_parent_id_param
LOOP
FOR zone_dns_r2 IN
select
zone_dns.*
from
zone_dns
where
zone_dns.zone_dns_parent_id = zone_dns_r.zone_dns_id
LOOP
FOR zone_dns_r3 IN zone_dns_from_zone_dns_id(zone_dns_r.zone_dns_id,
zone_dns_r2.zone_dns_id)
LOOP
RETURN (zone_dns_r3) AND RESUME;
END LOOP;
END LOOP;
RETURN (zone_dns_r) AND RESUME;
END LOOP;
RETURN;
END;
' LANGUAGE 'plpgsql';
From | Date | Subject | |
---|---|---|---|
Next Message | S Dawalt | 2002-02-18 19:32:08 | Sum of events over an interval; how? |
Previous Message | Dave Page | 2002-02-18 19:02:16 | Re: Hebrew support |