> You need conditional logic, which suggests pl/pgsql is the way to go.
Maybe he could use simple sql function like this:
create function check_loan(text,int,int) returns boolean as '
select (
select count(*) from kolcsonok where
code_user=($2) and code_loan=($3) and typet
=?iso-8859-1?Q?Miguel_Gonz=E1lez?= <[EMAIL PROTECTED]> writes:
> But I got that the parser cannot identify the =$ operator
You need a space between = and $.
regards, tom lane
---(end of broadcast)---
TIP 2: you can get off
Maybe the reason is that you defined the function to return bool, but are
attempting to return text?
You need conditional logic, which suggests pl/pgsql is the way to go.
Something simple should do it, like:
create function check_loan (text,int,int)
returns bool
as '
begin
select * from loans whe
On Wed, 19 Sep 2001, [iso-8859-1] Miguel González 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 id
by the way you know how to create the following sql function?
I need to return a boolean saying if an object is onloan.
the loan table is as follows:
loans
-
code_loan
code_user
typetable
i want to check these three fields, the first two fields (the code ones) are
integer and the last a s