pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kevin Jenkins <gameprogrammer@rakkar.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to test/read a stored procedure that returns a boolean?
Date: Wed, 16 Jan 2008 18:28:40 -0500
Message-ID: <29647.1200526120@sss.pgh.pa.us> (raw)
In-Reply-To: <478E901D.7060701@rakkar.org>
References: <478E901D.7060701@rakkar.org>

Kevin Jenkins <gameprogrammer@rakkar.org> writes:
> create or replace function IsUsedHandle(h text) returns boolean as $$
> declare
> begin
> select COUNT(*) as num_matches from handles where handles.handle = h;
> return num_matches > 0;
> end;
> $$ LANGUAGE plpgsql;

I think you've confused AS with INTO.

You forgot to declare num_matches as a local variable, too.

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <29647.1200526120@sss.pgh.pa.us>
Permalink:  ../29647.1200526120@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29647.1200526120@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, gameprogrammer@rakkar.org
  Subject: Re: How to test/read a stored procedure that returns a boolean?
  In-Reply-To: <29647.1200526120@sss.pgh.pa.us>

* 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