pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Help with Procedures in pgsql 2+ messages / 2 participants [nested] [flat]
* Help with Procedures in pgsql @ 2000-11-27 20:01 Nelio Alves Pereira Filho <nelio@ifx.com.br> 2000-12-01 06:32 ` Re: Help with Procedures in pgsql Robert B. Easter <reaster@comptechnews.com> 0 siblings, 1 reply; 2+ messages in thread From: Nelio Alves Pereira Filho @ 2000-11-27 20:01 UTC (permalink / raw) To: pgsql-sql I have the folowing procedure in PL/pgsql: CREATE FUNCTION set_counter () RETURNS INT AS ' DECLARE nivel_rec record; new_count integer; BEGIN UPDATE nivel SET count=-2; FOR nivel_rec IN SELECT * FROM nivel LOOP new_count := set_counter_row (nivel_rec); END LOOP; RETURN new_count; END;' LANGUAGE 'plpgsql'; I create it, but when I do 'select set_counter()', it says IFX=# select set_counter(); ERROR: Attribute 'nivel_rec' not found Isn't that the right sintax to declare variables in pgsql? What's wrong with it? Does my procedure contain any other errors that will appear later? Thanks -- Nelio Alves Pereira Filho IFX Networks Sao Paulo / Brazil ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Help with Procedures in pgsql 2000-11-27 20:01 Help with Procedures in pgsql Nelio Alves Pereira Filho <nelio@ifx.com.br> @ 2000-12-01 06:32 ` Robert B. Easter <reaster@comptechnews.com> 0 siblings, 0 replies; 2+ messages in thread From: Robert B. Easter @ 2000-12-01 06:32 UTC (permalink / raw) To: Nelio Alves Pereira Filho <nelio@ifx.com.br>; pgsql-sql On Monday 27 November 2000 15:01, Nelio Alves Pereira Filho wrote: > I have the folowing procedure in PL/pgsql: > > CREATE FUNCTION set_counter () RETURNS INT AS ' > DECLARE > nivel_rec record; > new_count integer; I always used the syntax like: nivel_rec nivel%ROWTYPE; Not sure it matters though. > BEGIN > UPDATE nivel SET count=-2; > > FOR nivel_rec IN SELECT * FROM nivel LOOP > new_count := set_counter_row (nivel_rec); > END LOOP; I don't know what set_counter_row() is doing so the problem could be in that function. > > RETURN new_count; > END;' > LANGUAGE 'plpgsql'; > > I create it, but when I do 'select set_counter()', it says > IFX=# select set_counter(); > ERROR: Attribute 'nivel_rec' not found > > Isn't that the right sintax to declare variables in pgsql? What's wrong > with it? > Does my procedure contain any other errors that will appear later? > > > > Thanks -- -------- Robert B. Easter reaster@comptechnews.com --------- - CompTechNews Message Board http://www.comptechnews.com/ - - CompTechServ Tech Services http://www.comptechserv.com/ - ---------- http://www.comptechnews.com/~reaster/ ------------ ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-12-01 06:32 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2000-11-27 20:01 Help with Procedures in pgsql Nelio Alves Pereira Filho <nelio@ifx.com.br> 2000-12-01 06:32 ` Robert B. Easter <reaster@comptechnews.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox