Re: Unable to run one pl/pgSQL function :-(

From: "PGMailList" <pgmail(at)pgexplorer(dot)com>
To: "Bruno Baguette" <bruno(dot)baguette(at)netcourrier(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Unable to run one pl/pgSQL function :-(
Date: 2002-06-24 16:03:45
Message-ID: 000701c21b98$c14022a0$05faa8c0@edios
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Postgres is case sensitive you should try to put all your table names within
"" (Double Quotes)

INSERT INTO "PEOPLES" VALUES ("SEQUENCE_Id".nextval(),''PeopleName'');

the '' around PeopleName is 2 single '

I hope this helps

http://www.pgexplorer.com

----- Original Message -----
From: "Bruno Baguette" <bruno(dot)baguette(at)netcourrier(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Sent: Friday, June 21, 2002 7:34 PM
Subject: [GENERAL] Unable to run one pl/pgSQL function :-(

> Hello,
>
> I've written a little pl/pgSQL function in order to use it on a little
> postgreSQL database :
>
> CREATE function tuple_add(VARCHAR(200)) RETURNS text AS
> '
> DECLARE
> Response text;
> PeopleName ALIAS FOR $1;
> BEGIN
> INSERT INTO PEOPLES VALUES (SEQUENCE_Id.NEXTVAL(),PeopleName);
> return Response;
> END;
> ' LANGUAGE 'plpgsql';
>
> When I add this function to my database, I don't receive any error
> message.
>
> But I don't success to use this function. I've tried like that :
>
> mabd=> SELECT tuple_add('One try');
> ERROR: parser: parse error at or near "("
> mabd=> SELECT tuple_add("One try");
> ERROR: Attribute 'One try' not found
>
> The PEOPLE database just contains two columns : an INTEGER and one
> VARCHAR(200). And the SEQUENCE_Id sequence I use is existing. I've also
> checked that pl/pgSQL has been activated to my database.
>
> The Response variable is to be used to get the eventual exception, but I
> have to find how I can do that.
>
> Can you explain me how can I use my pl/pgSQL function ?
>
> Thanks in advance ! :-)
>
> -------------------------------------------------
> Bruno BAGUETTE - bruno(dot)baguette(at)netcourrier(dot)com
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Bowlby 2002-06-24 16:21:53 Re: login issue..
Previous Message Mike Harding 2002-06-24 15:43:16 Astonishing explain...!