pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
function returning NULL?
2+ messages / 2 participants
[nested] [flat]

* function returning NULL?
@ 2001-04-30 08:56 Sandro Dentella <sandro.dentella@tin.it>
  2001-04-30 14:24 ` Re: [INTERFACES] function returning NULL? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Sandro Dentella @ 2001-04-30 08:56 UTC (permalink / raw)
  To: 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@ermit.it sandro.dentella@mi.infn.it 



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [INTERFACES] function returning NULL?
  2001-04-30 08:56 function returning NULL? Sandro Dentella <sandro.dentella@tin.it>
@ 2001-04-30 14:24 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2001-04-30 14:24 UTC (permalink / raw)
  To: Sandro Dentella <sandro.dentella@tin.it>; +Cc: pgsql-interfaces; pgsql-docs@postgresql.org

Sandro Dentella <sandro.dentella@tin.it> 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-04-30 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-04-30 08:56 function returning NULL? Sandro Dentella <sandro.dentella@tin.it>
2001-04-30 14:24 ` Tom Lane <tgl@sss.pgh.pa.us>

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