Thread: pl/pgsql function with argument of type DATE

pl/pgsql function with argument of type DATE

From
"Bojan"
Date:

How to invoke function which has arguments declared as type “date”?

 

I want to make function which will return a list of all dates between starting and ending

 date which are two arguments of that function. I tried with:

 

select * from foo(2008-06-01, 2008-06-09)

select * from foo(‘2008-06-01’, ‘2008-06-09’)

 

but type mismatch (date vs integer) error occurs.

 

Thanks,

 

     Bojan

 


No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.524 / Virus Database: 270.0.0/1486 - Release Date: 05/06/2008 18:29

Re: pl/pgsql function with argument of type DATE

From
"A. Kretschmer"
Date:
am  Tue, dem 10.06.2008, um 18:02:01 +0100 mailte Bojan folgendes:
> How to invoke function which has arguments declared as type ?date??
>
>
>
> I want to make function which will return a list of all dates between starting
> and ending
>
>  date which are two arguments of that function. I tried with:
>
>
>
> select * from foo(2008-06-01, 2008-06-09)
>
> select * from foo(?2008-06-01?, ?2008-06-09?)

select * from foo('2008-06-01'::date, '2008-06-09'::date);

Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

Re: pl/pgsql function with argument of type DATE

From
"Pavel Stehule"
Date:
2008/6/10 Bojan <bojank@brandcomms.com>:
> How to invoke function which has arguments declared as type "date"?
>
>
>
> I want to make function which will return a list of all dates between
> starting and ending
>
>  date which are two arguments of that function. I tried with:
>
>
>
> select * from foo(2008-06-01, 2008-06-09)

it's nonsense :) you call foo with values (2001, 1993)

Pavel
>
> select * from foo('2008-06-01', '2008-06-09')
>
>
>
> but type mismatch (date vs integer) error occurs.
>
>
>
> Thanks,
>
>
>
>      Bojan
>
>
>
> No virus found in this outgoing message.
> Checked by AVG.
> Version: 7.5.524 / Virus Database: 270.0.0/1486 - Release Date: 05/06/2008
> 18:29
>