Re: insert within pl/pgsql procedures: NOVICE question ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Anto <antojf2001(at)yahoo(dot)fr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: insert within pl/pgsql procedures: NOVICE question ?
Date: 2002-02-13 22:21:37
Message-ID: 1164.1013638897@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?iso-8859-1?q?Jeff=20Anto?= <antojf2001(at)yahoo(dot)fr> writes:
> am I wrong or the optionnal syntax
> INSERT INTO foo(foo_col1) VALUES ('blahblah');
> dosen't work within a PLPGSQL-written function ?

Works for me:

regression=# create table foo(foo_col1 text);
CREATE
regression=# INSERT INTO foo(foo_col1) VALUES ('blahblah');
INSERT 1918283 1
regression=# create function doit(text) returns int as '
regression'# begin
regression'# INSERT INTO foo(foo_col1) VALUES ($1);
regression'# return 1;
regression'# end' language plpgsql;
CREATE
regression=# select doit('zzz');
doit
------
1
(1 row)

regression=# select * from foo;
foo_col1
----------
blahblah
zzz
(2 rows)

regression=#

What are you doing differently?

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-02-13 22:25:10 Re: insert within pl/pgsql procedures: NOVICE question ?
Previous Message Darren Ferguson 2002-02-13 22:04:16 Re: insert within pl/pgsql procedures: NOVICE question ?