Received: from infnmi1.mi.infn.it (infnmi1.mi.infn.it [192.135.14.77]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f3U8qb376479 for ; Mon, 30 Apr 2001 04:52:37 -0400 (EDT) (envelope-from sandro.dentella@tin.it) Received: from pcgun.mi.infn.it (IDENT:root@maxmod13.mi.infn.it [192.84.141.206]) by infnmi1.mi.infn.it (8.9.1a/8.8.8/infnmi) with ESMTP id KAA15983 for ; Mon, 30 Apr 2001 10:52:23 +0200 (MET DST) Received: (from sandro@localhost) by pcgun.mi.infn.it (8.9.3/8.8.5) id KAA06535 for pgsql-interfaces@postgresql.org; Mon, 30 Apr 2001 10:56:00 +0200 X-Authentication-Warning: bluff.ermit.it: sandro set sender to sandro.dentella@tin.it using -f Date: Mon, 30 Apr 2001 10:56:00 +0200 From: Sandro Dentella To: pgsql-interfaces@postgresql.org Subject: function returning NULL? Message-ID: <20010430105600.B6311@bluff.ermit.it> Mail-Followup-To: pgsql-interfaces@postgresql.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i X-Archive-Number: 200104/135 X-Sequence-Number: 1519 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@ermit.it sandro.dentella@mi.infn.it