Re: Creating a boolean function

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Miguel González <iafmgc(at)unileon(dot)es>
Cc: PostgreSQL SQL <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Creating a boolean function
Date: 2001-09-19 19:36:04
Message-ID: Pine.BSF.4.21.0109191233410.69032-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 19 Sep 2001, [iso-8859-1] Miguel Gonzlez wrote:

> I tried
>
> create function check_loan (text,int,int)
> returns bool
> as
> 'select CAST(typetable AS text) from loans where typetable=$1 and
> code_user=$2 and code_loan=$3;'
> language 'sql';
>
>
> But I got that the parser cannot identify the =$ operator and requires me to
> do the proper casting.
>
> How can I do it? Sorry for the questions, but I am new at creating functions
> and I have to hand in this project tomorrow.

You can probably get away with just putting a space before the arguments,
so '= $1' rather than '=$1'.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Eckermann 2001-09-19 19:54:38 Re: Creating a boolean function
Previous Message Brett Schwarz 2001-09-19 19:01:05 Re: Holiday Calculations?