function returning NULL?
function returning NULL?
От:
Sandro Dentella <sandro.dentella@tin.it>
Дата:
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
Re: function returning NULL?
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Sandro Dentella writes: > 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. You need the "return_null" command, which is new in 7.1 --- before that there was no way to do it in pltcl. "return_null" seems to be missing from the documentation :-(. No wonder you couldn't find it. regards, tom lane