X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0383947580B for ; Sun, 23 Feb 2003 17:07:51 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 28901-08 for ; Sun, 23 Feb 2003 17:07:40 -0500 (EST) Received: from luckydigital.com (www.luckydigital.com [203.109.157.4]) by postgresql.org (Postfix) with ESMTP id 9D1B1474E53 for ; Sun, 23 Feb 2003 17:07:39 -0500 (EST) Received: from jax (203-109-198-1.akl.ihugultra.co.nz [203.109.198.1]) by luckydigital.com (8.11.6/8.10.0) with SMTP id h1NM7eC14410 for ; Mon, 24 Feb 2003 11:07:40 +1300 Message-ID: <006401c2db87$fc09be00$c900a8c0@jax> From: "James Cooper" To: "sql" Subject: syntax question Date: Mon, 24 Feb 2003 11:07:41 +1300 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0061_01C2DBF4.F2C5D5F0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/516 X-Sequence-Number: 11914 This is a multi-part message in MIME format. ------=_NextPart_000_0061_01C2DBF4.F2C5D5F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable FOR total IN EXECUTE subquery LOOP END LOOP; RETURN total.tot; I have a function that returns a total from a dynamic query I use to genera= te the total query I've tried to modify it as a loop to get a single row value is unnecessary = but I'm failing on my syntax I've tried=20 select into total subquery=20 -but it wont work(when I attempt this I remove the select from the beginnin= g of my sub query) can someone show me the syntax to execute a select into with a string that = contains a query in it? James ------=_NextPart_000_0061_01C2DBF4.F2C5D5F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

FOR total IN EXECUTE subquery LOOP

END LOOP;

RETURN total.tot;

 

I have a function that returns a total from a dynamic que= ry I=20 use to generate the total query

I've tried to modify it as a loop to get a single row val= ue is=20 unnecessary but I'm failing on my syntax

I've tried

select into total subquery

-but it wont work(when I attempt this I remove the select= from=20 the beginning of my sub query)

can someone show me the syntax to execute a select into w= ith a=20 string that contains a query in it?

 

James

------=_NextPart_000_0061_01C2DBF4.F2C5D5F0--