Received: from smtp-3.ig.com.br (smtp-3.ig.com.br [200.225.157.62] (may be forged)) by mail.postgresql.org (8.11.3/8.11.1) with SMTP id f2SIxDU52128 for ; Wed, 28 Mar 2001 13:59:13 -0500 (EST) (envelope-from edipoelder@ig.com.br) Message-Id: <200103281859.f2SIxDU52128@mail.postgresql.org> Received: (qmail 9098 invoked from network); 28 Mar 2001 18:59:10 -0000 Received: from webmail-5.ig.com.br (HELO localhost) (200.225.157.83) by smtp-3.ig.com.br with SMTP; 28 Mar 2001 18:59:10 -0000 Date: Wed, 28 Mar 2001 15:59:08 -0300 To: pgsql-sql@postgresql.org From: edipoelder@ig.com.br Cc: X-Originating-IP: [200.225.157.84]200.19.161.175 X-Mailer: InMail by Insite - www.insite.com.br X-user: edipoelder@ig.com.br Subject: Function with now() | time 'now' | etc... X-Archive-Number: 200103/585 X-Sequence-Number: 2255 Hi all, I wrote the folling function: DROP FUNCTION PROC_TESTE(INTEGER); CREATE FUNCTION PROC_TESTE(INTEGER) RETURNS INTEGER AS ' DECLARE SEQ RECORD; BEGIN SELECT NEXTVAL(''TEMPOS_ID_SEQ'') AS ID INTO SEQ; INSERT INTO TEMPOS (ID, INICIO) VALUES (SEQ.ID, NOW()); FOR I IN 1..$1 LOOP INSERT INTO TESTE(VALOR) VALUES (RANDOM()*$1); END LOOP; UPDATE TEMPOS SET FIM = NOW() WHERE ID = SEQ.ID; RETURN SEQ.ID; END;' LANGUAGE 'PLPGSQL'; And all times I run it ("select proc_teste(10000);"), i got the folling behavour: teste=> SELECT * FROM TEMPOS; inicio | fim | id ----------+----------+---- 15:12:17 | 15:12:17 | 23 15:12:18 | 15:12:18 | 24 (...) It doesn't getting different times on each execution. I also tried put "timestamp 'now'" insted "now()". What am I doing wrong? Thank you, Edipo Elder [edipoelder@ig.com.br] _________________________________________________________ Oi! Você quer um iG-mail gratuito? Então clique aqui: http://www.ig.com.br/paginas/assineigmail.html