Johan Wehtje wrote:
> This is probably obvious but I am not seeing what is going wrong with
> this function definition:
>
> CREATE OR REPLACE FUNCTION "public"."cproc_hli" (bgtemp NUMERIC,
> humidity NUMERIC, wspeed NUMERIC) RETURNS NUMERIC AS
> IF ($1 < 25)
> THEN
> SELECT (10.66 * (0.28 * $2)+(1.
slight modification to the previous post, sorry, see
http://www.postgresql.org/docs/8.0/interactive/plpgsql-structure.html
for the real docs.
CREATE OR REPLACE FUNCTION "public"."cproc_hli" (bgtemp NUMERIC,
humidity NUMERIC, wspeed NUMERIC) RETURNS NUMERIC AS $$
BEGIN
IF ($1 < 25) THEN
SELEC
Thanks for your help, I adjusted the function after a better reading of
the pl/Sql chapter - and feel I posted in haste.
Hopefully though it may prove useful to someone else.
Cheers
Johan Wehtje
Thomas F. O'Connell wrote:
On Oct 24, 2005, at 11:27 AM, Johan Wehtje wrote:
This is probably obv
On Oct 24, 2005, at 11:27 AM, Johan Wehtje wrote:
This is probably obvious but I am not seeing what is going wrong
with this function definition:
CREATE OR REPLACE FUNCTION "public"."cproc_hli" (bgtemp NUMERIC,
humidity NUMERIC, wspeed NUMERIC) RETURNS NUMERIC AS
IF ($1 < 25)
THEN
SELECT
The variant you're showing here has absolutely no quoting for the
function body. You need to quote the body, and escape the quotes you
have inside the body (in this example you don't have any).
Wrap the body in BEGIN ... END.
Also put semicolons after each statement end.
Corrected code:
CREATE O