pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robins Tharakan <tharakan@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: postgresql function not accepting null values inselect statement
Date: Mon, 25 Feb 2008 12:26:35 +0530
Message-ID: <36af4bed0802242256i7f0e7a36i4f0cf4b567dfadc2@mail.gmail.com> (raw)
In-Reply-To: <36af4bed0802242256g7dd98934mc7bdbba1a6bf33b3@mail.gmail.com>
References: <001501c8752d$391c8e50$ab55aaf0$@com>
	<001a01c87534$84eea280$8ecbe780$@com>
	<47BEA582.A3DD.0030.0@indicator.be>
	<200802220830.56917.jfabiani@yolo.com>
	<002401c8776e$17698b80$463ca280$@com>
	<36af4bed0802242256g7dd98934mc7bdbba1a6bf33b3@mail.gmail.com>

>
> What version of PostGreSQL are you using ?
> Are you sure there was no typing error ? This SQL should work in the most
> recent version of PG.( at least version 8.1 onwards)
>
> *Robins*
>
>
> On Mon, Feb 25, 2008 at 10:50 AM, Jyoti Seth <jyotiseth2001@gmail.com>
> wrote:
>
> > I have tried this, but it is showing following error:
> > ERROR: syntax error at or near "DISTINCT"
> > SQL state: 42601
> >
> > Thanks,
> > Jyoti
> >
> >
> > -----Original Message-----
> > From: pgsql-sql-owner@postgresql.org [mailto:
> > pgsql-sql-owner@postgresql.org]
> > On Behalf Of johnf
> > Sent: Friday, February 22, 2008 10:01 PM
> > To: pgsql-sql@postgresql.org
> > Subject: Re: [SQL] postgresql function not accepting null values
> > inselect
> > statement
> >
> > On Friday 22 February 2008 01:35:47 am Bart Degryse wrote:
> > > Can you try this...
> > >
> > > CREATE OR REPLACE FUNCTION getfunctionaries(p_statecd integer)
> > >   RETURNS SETOF t_functionaries AS
> > > $BODY$
> > > DECLARE
> > >   rec t_functionaries%ROWTYPE;
> > > BEGIN
> > >   FOR rec IN (
> > >     SELECT f.functionaryid, f.category, f.description
> > >     FROM functionaries f
> > >     WHERE f.statecd IS NOT DISTINCT FROM p_statecd)
> > >   LOOP
> > >     return next rec;
> > >   END LOOP;
> > >   return;
> > > END;
> > > $BODY$
> > > LANGUAGE 'plpgsql' VOLATILE;
> > >
> > a newbie question.  Could you explain why yours works?  I don't
> > understand
> > how
> > it works if p_statecd = NULL
> >
> >
> > --
> > John Fabiani
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Have you searched our list archives?
> >
> >               http://archives.postgresql.org
> >
>
>

view thread (11+ messages)  latest in thread

Message-ID: <36af4bed0802242256i7f0e7a36i4f0cf4b567dfadc2@mail.gmail.com>
Permalink:  ../36af4bed0802242256i7f0e7a36i4f0cf4b567dfadc2@mail.gmail.com/
Also on:    postgresql.org/message-id/36af4bed0802242256i7f0e7a36i4f0cf4b567dfadc2@mail.gmail.com

 · 

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: tharakan@gmail.com
  Subject: Re: postgresql function not accepting null values inselect statement
  In-Reply-To: <36af4bed0802242256i7f0e7a36i4f0cf4b567dfadc2@mail.gmail.com>

* 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