pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kovacs Baldvin <kb136@hszk.bme.hu>
To: Jeff Eckermann <jeckermann@verio.net>
Cc: Miguel González <iafmgc@unileon.es>
Cc: PostgreSQL SQL <pgsql-sql@postgresql.org>
Subject: Re: Creating a boolean function
Date: Thu, 20 Sep 2001 00:03:51 +0200 (MEST)
Message-ID: <Pine.GSO.4.33.0109192359180.6780-100000@ural2> (raw)
In-Reply-To: <01a001c14144$ebd04100$279c10ac@INTERNAL>

> 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 typetable=($1)
        ) > 0;
' language 'sql';

The immediate benefit of it is that there's no need to install
a procedural languge for this simple task.

Regards,
Baldvin




view thread (5+ messages)

Message-ID: <Pine.GSO.4.33.0109192359180.6780-100000@ural2>
Permalink:  ../Pine.GSO.4.33.0109192359180.6780-100000@ural2/
Also on:    postgresql.org/message-id/Pine.GSO.4.33.0109192359180.6780-100000@ural2

 · 

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: kb136@hszk.bme.hu, jeckermann@verio.net, iafmgc@unileon.es
  Subject: Re: Creating a boolean function
  In-Reply-To: <Pine.GSO.4.33.0109192359180.6780-100000@ural2>

* 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