anal about my syntax

From: "James Cooper" <jim(at)luckydigital(dot)com>
To: "sql" <pgsql-sql(at)postgresql(dot)org>
Subject: anal about my syntax
Date: 2003-02-11 22:26:47
Message-ID: 00f201c2d21c$aa14c3c0$c900a8c0@jax
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello All

I was looking at this plpgsql function:

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.
2. could this be a straight SQL function instead( I dont think you can append strings together in SQL functions )

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Wei Weng 2003-02-11 23:28:38 What is wrong with this identification configuration?
Previous Message Wei Weng 2003-02-11 21:26:01 What's wrong with this identification configuration?