From: Josh Berkus <josh@agliodbs.com>
To: James Cooper <jim@luckydigital.com>
To: sql <pgsql-sql@postgresql.org>
Subject: Re: anal about my syntax
Date: Tue, 11 Feb 2003 17:10:35 -0800
Message-ID: <web-2835260@davinci.ethosmedia.com> (raw)
In-Reply-To: <00f201c2d21c$aa14c3c0$c900a8c0@jax>
James,
> FOR rec IN EXECUTE
> ''select count(person_id) as total from person where person_email
> like '''''' || $1 || ''%'''' and person_id IN
> (
> select cp.person_id from cluster_person cp, cluster c where
> cp.cluster_id = c.cluster_id and c.c_id = '' || $2 || ''group by
> cp.person_id
> ) ''
> LOOP
> tot = 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.
Not as written, no.
> 2. could this be a straight SQL function instead( I dont think you
> can append strings together in SQL functions )
Yes, it could. If I have time later, I'll draft you an example.
-Josh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com, jim@luckydigital.com
Subject: Re: anal about my syntax
In-Reply-To: <web-2835260@davinci.ethosmedia.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox