create function(date,date,date,...)

From: Radek Kanovsky <radekk(at)uh(dot)cz>
To: pgsql-sql(at)postgreSQL(dot)org
Subject: create function(date,date,date,...)
Date: 1999-09-25 17:51:01
Message-ID: Pine.LNX.3.96.990925193818.18476s-100000@rk.uh.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Hi,

i am trying to declare function that gets six date arguments
and returns some status according actual date. It looks like
this:

CREATE FUNCTION datum_ok(DATE,DATE,DATE,DATE,DATE,DATE) RETURNS TEXT AS '
DECLARE
tests ALIAS FOR $1 ;
teste ALIAS FOR $2 ;
payments ALIAS FOR $3 ;
paymente ALIAS FOR $4 ;
interrupts ALIAS FOR $5 ;
interrupte ALIAS FOR $6 ;
today DATE ;
BEGIN
today := now()::date ;
.....

It happens that when some argument is NULL, than all argument get NULL.
It works correctly only when all arguments are not NULL.

SELECT
login,
datum_ok(
test_start, test_end,
payment_start, payment_end,
interrupt_start, interrupt_end )
FROM service ;

How can I mix NULL and DATE values in arguments?

Thanks

Radek Kanovsky, rk(at)uh(dot)cz

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martin Weinberg 1999-09-26 02:13:17 Memory exhausted in AllocSetAlloc()
Previous Message Peter Mount 1999-09-25 10:06:41 Re: [GENERAL] Is it possible run pgsql in Windows 95 ?

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-09-25 22:46:50 Re: [SQL] create function(date,date,date,...)
Previous Message Radek Kanovsky 1999-09-25 15:15:11 11128.1 != 11128.1