Skip site navigation (1) Skip section navigation (2)

function returning NULL?

From: Sandro Dentella <sandro(dot)dentella(at)tin(dot)it>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: function returning NULL?
Date: 2001-04-30 08:56:00
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-docspgsql-interfaces
I'm trying to create a function that should return a date, and occasionally
NULL value. I can't see how to do that. I'm using pl/tcl.

CREATE FUNCTION "start" (text,text) RETURNS date AS '
     regsub ^. $1 "$2" job
     spi_exec "select start_date from jobs where job_code = ''$job''" {
	 if {[info exist start_date]} {
	      return $start_date
#     return "2/2/2222"  HERE I want NULL
     return "2/2/2222"
'LANGUAGE 'pltcl';

That is to say I'd like to have a function that returns a date but under
some circumstancies it leave it blanck.


Sandro Dentella  *:-)
e-mail: sandro(at)ermit(dot)it sandro(dot)dentella(at)mi(dot)infn(dot)it 


pgsql-docs by date

Next:From: Vince VielhaberDate: 2001-04-30 10:19:53
Subject: Re: Developer vs. Programmer
Previous:From: Bruce MomjianDate: 2001-04-30 04:25:37
Subject: Mention of connection options

pgsql-interfaces by date

Next:From: Justin BanksDate: 2001-04-30 12:53:02
Subject: Re: libpq++
Previous:From: Sandro DentellaDate: 2001-04-30 08:48:58
Subject: Re: libpgtcl and passwords

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group