Initializing variables from SQL query

From: jc_mich <juan(dot)michaca(at)paasel(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Initializing variables from SQL query
Date: 2009-03-20 00:25:03
Message-ID: 22612191.post@talk.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi all

I'm new in PL/PGSQL developing, I'm trying to initialize a variable from a
SQL query, this query counts some rows, I've made the next code, but it
doesn't work.

CREATE FUNCTION schema.myFunction() RETURNS BOOLEAN AS $$
DECLARE
counter RECORD;
BEGIN
SELECT * INTO STRICT counter FROM (SELECT COUNT (DISTINCT (rows)) FROM
schema.table);

I'm pretty annoyed, because I've found some examples that use this kind of
variable initialization.

Is there someone who know what I did wrong?

Thanks!

--
View this message in context: http://www.nabble.com/Initializing-variables-from-SQL-query-tp22612191p22612191.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2009-03-20 00:49:09 Re: array_agg and libpq(xx)
Previous Message John Cheng 2009-03-20 00:09:34 Re: Is there a meaningful benchmark?