Re: date and time - Mailing list pgsql-general

From Alain Roger
Subject Re: date and time
Date
Msg-id 75645bbb0803240815i20393e41v6c7ef8de7736e8b5@mail.gmail.com
Whole thread Raw
In response to Re: date and time  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-general
So thanks a lot to everybody... so here is the result.

1. the semicolon was missing after the INSERT as wrote Raymond.
2. CURRENT_TIMESTAMP works great
3. i use pl/pgsql as language

thanks again.
Alain

On Mon, Mar 24, 2008 at 3:56 PM, Thomas Kellerer <spam_eater@gmx.net> wrote:
Alain Roger wrote on 24.03.2008 15:45:
>> SELECT count(*) INTO existing_email FROM cust_portal.tmp_newsletterreg;
>>     if (existing_email <>0) then
>>     {
>>         result = false;
>>     }
>>     else
>>     {
>>         result = true;
>>         INSERT INTO cust_portal.tmp_newsletterreg VALUES
>>         (
>>             nextval( 'tmp_newsletterreg_nlreg_id_seq' ),
>>             email,
>>             session,
>>             SELECT CURRENT_TIMESTAMP;
>>         )
>>     }
>>     end if;
>>
>>     RETURN(result);


That should be

INSERT INTO cust_portal.tmp_newsletterreg VALUES
(
    nextval( 'tmp_newsletterreg_nlreg_id_seq' ),
    email,
    session,
    CURRENT_TIMESTAMP
)

There is no SELECT and no semicolon inside the INSERT

Thomas


-
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

pgsql-general by date:

Previous
From: Edoardo Panfili
Date:
Subject: Re: C function and enum types parameters
Next
From: Tony Caduto
Date:
Subject: Re: date and time