Re: anal about my syntax

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "James Cooper" <jim(at)luckydigital(dot)com>, "sql" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: anal about my syntax
Date: 2003-02-12 01:10:35
Message-ID: web-2835260@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2003-02-12 01:45:24 Re: What is wrong with this identification configuration?
Previous Message Lex Berezhny 2003-02-12 00:33:03 Re: Working with very large datasets