Re: Can't see what's wrong with this function?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bjørn T Johansen <btj(at)havleik(dot)no>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Can't see what's wrong with this function?
Date: 2006-08-28 18:10:13
Message-ID: 14699.1156788613@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?ISO-8859-1?Q?Bj=F8rn?= T Johansen <btj(at)havleik(dot)no> writes:
> I am trying to create a function but I don't get further than this and something is already wrong...
> The function so far look like this..:

> CREATE OR REPLACE FUNCTION getNettoHastighet (INTEGER) RETURNS INTEGER AS '
> DECLARE
> total bigint;
> BEGIN
> select into tmprec (extract(epoch from sum(Til - Fra)) * 1000.0) as total from Log_stop where OrdreID = ordreid_val and StopType = 1;

Don't use plpgsql variable names that conflict with names you use in
your queries. In this case it's trying to replace "AS total" with
a reference to that plpgsql variable named total.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Douglas McNaught 2006-08-28 18:12:46 Re: Precision of data types and functions
Previous Message Bjørn T Johansen 2006-08-28 17:50:42 Can't see what's wrong with this function?