Received: from ns.canad.ro (IDENT:root@ns.canad.ro [193.230.177.1]) by hub.org (8.9.3/8.9.3) with ESMTP id JAA22882 for ; Thu, 24 Jun 1999 09:14:01 -0400 (EDT) (envelope-from tiberiu@akela.ro) Received: from ns (root@ns.akela.ro [193.226.47.105]) by ns.canad.ro (8.9.3/8.9.3) with ESMTP id QAA10286; Thu, 24 Jun 1999 16:12:34 +0300 Received: from tibi (tibi.akela.ro [192.168.1.2]) by ns (8.9.1/8.9.1) with SMTP id QAA21658; Thu, 24 Jun 1999 16:12:37 -0200 Message-ID: <013501bebe42$ea71d440$0201a8c0@tibi.akela.ro> From: "Tiberiu Craciun" To: "Eric BASIER" Cc: Subject: Re:Re: [SQL] problem with PL/pgSQL Date: Thu, 24 Jun 1999 16:10:21 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 I don't think that is, because the error is still there. -----Original Message----- From: Eric BASIER To: Tiberiu Craciun Cc: pgsql-sql@hub.org Date: jeudi 24 juin 1999 19:51 Subject: Re: [SQL] problem with PL/pgSQL >I insert my response in your text >Tiberiu Craciun wrote: > >> I have a table and a function defined like that : create table trafic >> ( >> statie text, >> traf_in int8 default 0, >> traf_out int8 default 0 >> ); create function addtrafic (text, int8, int2) returns int2 as ' >> declare >> statia alias for $1 ; >> traficul alias for $2 ; >> directia alias for $3 ; >> begin >> select * from trafic where statie= $1; >> if not found then >> insert into trafic (statie) values( $1 ); > > there is an error here ^ >the good sentence is : insert into trafic (statie) values ($1) ; > > > >> endif; >> if $3 < 1 then >> update trafic set traf_in=traf_in+ $2 where statie= >> $1; >> else >> update trafic set traf_out=traf_out+ $2 where statie= >> $1; >> endif; >> return $3 ; >> end; >> ' language 'plpgsql'; when I run this SQL : select >> addtrafic('station1',10,0) as test; I got an error like that : NOTICE: >> plpgsql: ERROR during compile of addtrafic near line 20ERROR: parse >> error at or near ";" and i don't know what is wrong, can someone help >> me ? > > > >-- >Basier Eric e-mail : basier@ipgp.jussieu.fr >http://geoscope.ipgp.jussieu.fr >IPGP Observatoires Sismologie-Volcanologie >4,Place Jussieu 75005 Paris Tour 24-14 4eme Etage Tel 01 44 27 38 96 > > >