Help with functions (Never mind)

From: "Patrick Bye (WFF)" <PBYE(at)Westfair(dot)CA>
To: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Help with functions (Never mind)
Date: 2003-03-03 22:38:33
Message-ID: 0D485272F9CB4E4AA9171FD13CBAC78206BD9DF1@ntexsrvr.westfair.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Never mind my previous note. I rtfm'd and found out I was mixing my Oracle
PL/SQL and postgres with regards to the end command.

I'm having trouble trying to create a function. I'm new to functions and
I'm trying to figure them out but I can't even get something simple like
this to work. I believe I should be able to do 'SELECT getprice('text1',
'text2', 'text3', 'text4') as price' but all I get in PGAdmin tool is syntax
error near getprice. Is my SELECT statement wrong or my function. I did a
createlang on plpgsql before I started. I'm running 7.2.4.

CREATE FUNCTION getprice(text, text, text, text) RETURNS float8 AS 'DECLARE
v_itemnum ALIAS FOR $1;
v_custnum ALIAS FOR $2;
v_pcid ALIAS FOR $3;
v_branch ALIAS FOR $4;
BEGIN
RETURN 0;
END getprice;

' LANGUAGE 'plpgsql';

Patrick Bye
Programmer / Analyst
Westfair Foods Ltd.
pbye(at)westfair(dot)ca
(403) 291-6538

Browse pgsql-general by date

  From Date Subject
Next Message Brandon Craig Rhodes 2003-03-03 22:55:06 Re: Help with functions
Previous Message Munteanu Gabriel 2003-03-03 22:36:21 Re: wal-debug