Skip site navigation (1) Skip section navigation (2)

Re: need some help with pl-pgsql

From: Adrian Klaver <aklaver(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: justin <justin(at)emproshunts(dot)com>
Subject: Re: need some help with pl-pgsql
Date: 2008-12-23 22:20:02
Message-ID: 200812231420.02373.aklaver@comcast.net (view raw or flat)
Thread:
Lists: pgsql-general
On Tuesday 23 December 2008 1:04:49 pm justin wrote:
> have a function written in pgsql   it runs just fine, except its doing
> something really stupid.
>
> The function runs just fine till this select statement
>
> Select (wo_wipvalue/wo_qtyord)
>          into _TotalCost
>          from wo
>          where wo_id = pWoid ;
>
> This goes to the work order header table to gets the current value
> divided by current qty thats been completed so far, then sticks the
> value into _TotalCost variable based on the parameter passed into
> variable pWoid.
>
> problem is it returns NULL  which is impossible as i can manually run
> the select statement and get the $1.589445
>
> I have no idea how to fix this problem going forward???
>
>
> and the database is 8.3.5 running Ubuntu 8.0 lts

Would help to see the whole function. Also make sure you did not name one of 
the variables the same as a column name, this will confuse plpgsql.  Are you 
using the same value for wo_id in the function as in the manual select 
statement?

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

In response to

Responses

pgsql-general by date

Next:From: justinDate: 2008-12-23 22:33:22
Subject: Re: need some help with pl-pgsql
Previous:From: Karsten HilbertDate: 2008-12-23 22:17:42
Subject: Re: encoding of PostgreSQL messages

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group