Subject: anal about my syntax
Date: Wed, 12 Feb 2003 11:26:47 +1300
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_00EF_01C2D289.A0DA2A80"
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 AMaViS new-20020517
X-Archive-Number: 200302/223
X-Sequence-Number: 11621
This is a multi-part message in MIME format.
------=_NextPart_000_00EF_01C2D289.A0DA2A80
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello All=20
I was looking at this plpgsql function:=20
FOR rec IN EXECUTE
''select count(person_id) as total from person where person_email like ''''=
'' || $1 || ''%'''' and person_id IN=20
(
select cp.person_id from cluster_person cp, cluster c where cp.cluster_id =
=3D c.cluster_id and c.c_id =3D '' || $2 || ''group by cp.person_id
) ''
LOOP
tot =3D rec.total;
END LOOP;
It works fine - I was just wondering if you can:
1. execute this sql without a loop being used as its not required.
2. could this be a straight SQL function instead( I dont think you can appe=
nd strings together in SQL functions )
------=_NextPart_000_00EF_01C2D289.A0DA2A80
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello All
I was looking at this plpgsql=20
function:
FOR rec IN EXECUTE
''sel=
ect=20
count(person_id) as total from person where person_email like '''''' || $1 =
||=20
''%'''' and person_id IN
(
select cp.person_id from cluster_person c=
p,=20
cluster c where cp.cluster_id =3D c.cluster_id and c.c_id =3D '' || $2 || '=
'group by=20
cp.person_id
) ''
LOOP
tot =3D rec.total;
END=20
LOOP;
It works fine - I was =
just=20
wondering if you can:
1. execute this sql without=
a loop=20
being used as its not required.
2. could this be a straight=
SQL=20
function instead( I dont think you can append strings together in SQL=
=20
functions )