Re: No Return??

From: Adrian Klaver <aklaver(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: Bob Pawley <rjpawley(at)shaw(dot)ca>
Subject: Re: No Return??
Date: 2008-04-13 20:20:50
Message-ID: 200804131320.50679.aklaver@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sunday 13 April 2008 1:07 pm, Bob Pawley wrote:
> I'm getting a little frustrated with this problem.
>
> Can anyone tell me what is wrong with the following code.
>
> I have tested the portions separately and they all work.
>
> When I try it as a whole I get the message "control reached end of trigger
> procedure without RETURN."
>
> Any help greatly appreciated.
>
> Bob
>
> Declare
> pumpnumber integer;
>
> Begin
>
> Select count(*) Into pumpnumber From p_id.devices, p_id.processes
> Where device_number = '11'
> and p_id.devices.fluid_id = p_id.processes.fluid_id
> and p_id.processes.ip_op_equipment = 'op';
>
> If pumpnumber = 1 then
> Update p_id.devices
> Set number = '#1'
> From p_id.processes
> Where p_id.devices.number is null
> and p_id.devices.device_number = '11'
> and p_id.devices.fluid_id = p_id.processes.fluid_id
> and p_id.processes.ip_op_equipment = 'op' ;
>
> Else If pumpnumber = 2 Then

Should be elsif or elseif

> Update p_id.devices
> Set number = '#2'
> From p_id.processes
> Where p_id.devices.number is null
> and p_id.devices.device_number = '11'
> and p_id.devices.fluid_id = p_id.processes.fluid_id
> and p_id.processes.ip_op_equipment = 'op' ;
>
> End If;
> RETURN NULL;
> End If;

Eliminate this 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.
>
> B

--
Adrian Klaver
aklaver(at)comcast(dot)net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2008-04-13 20:26:12 Re: No Return??
Previous Message Harald Armin Massa 2008-04-13 20:18:50 Re: No Return??