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: 20010430105600.B6311@bluff.ermit.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-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.

TIA
sandro
*:-)

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

Responses

Browse pgsql-docs by date

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

Browse pgsql-interfaces by date

  From Date Subject
Next Message Justin Banks 2001-04-30 12:53:02 Re: libpq++
Previous Message Sandro Dentella 2001-04-30 08:48:58 Re: libpgtcl and passwords