Search Postgresql Archives

Re: No Return??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 13, 2008 at 01:07:26PM -0700, Bob Pawley wrote:
> When I try it as a whole I get the message "control reached end of trigger 
> procedure without RETURN."

I've re-indented the code to make it a bit more obvious what's going on
in your old version:

> DECLARE
>   pumpnumber integer;
> BEGIN
>   SELECT count(*) INTO pumpnumber [...]
>   IF pumpnumber = 1 THEN
>     UPDATE p_id.devices [...]
>   ELSE 
>     IF pumpnumber = 2 THEN
>       UPDATE p_id.devices [...]
>     END IF;
>     RETURN NULL;
>   END IF;
> END;
> 
> I have tried 'Return New' and 'Return Result' without luck, and if I leave 
> off either of the two 'End If ' statements the procedure returns an error.

I think you're looking for either "ELSIF" or "ELSEIF", you've got
white space between the ELSE and the IF which is introducing a new
sub-expression.  Either that, or move the RETURN after the final END IF.


  Sam


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux