pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Skeets and Kim Norquist <norqu2@juno.com>
To: pgsql-sql@postgresql.org
Subject: plpgsql function gets wierd with Null parameters
Date: Wed, 28 Jun 2000 11:27:53 -0700
Message-ID: <20000628.112753.-439695.1.norqu2@juno.com> (raw)


When I call the following plpgsql function with the last two parameters
as Null, the first parameter loses it's value:
    ma=> select createFund('fred', null, null);
     createfund
    ------------
    
    (1 row)	

However it works fine when I give values to the last two params:
    ma=> select createFund('fred', 'joe', 5);
     createfund
    ------------
     fred
    (1 row)

Here's the function (I've hacked it so that it just returns the first
parameter):
    create function createFund(varchar, varchar, int) returns text as '
    DECLARE
            fundname        ALIAS FOR $1;
            fundsymbol      ALIAS FOR $2;
            fundcusip       ALIAS FOR $3;
            existing        varchar(100);
            fundid          int;
            rec                     RECORD;
            retval          text;
            datecount       smallint;
    BEGIN
            RETURN fundname;
            ...
    END;
    ' language 'plpgsql';

Any ideas?

-Skeets Norquist
________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk!  For your FREE software, visit:
http://dl.www.juno.com/get/tagj.



Message-ID: <20000628.112753.-439695.1.norqu2@juno.com>
Permalink:  ../20000628.112753.-439695.1.norqu2@juno.com/
Also on:    postgresql.org/message-id/20000628.112753.-439695.1.norqu2@juno.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: norqu2@juno.com
  Subject: Re: plpgsql function gets wierd with Null parameters
  In-Reply-To: <20000628.112753.-439695.1.norqu2@juno.com>
  References: <20000628.112753.-439695.1.norqu2@juno.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