Re: [SQL] Cursor names in a self-nested function

2011-08-18 Thread Tom Lane
Pavel Stehule writes: > you can use a refcursor type > http://developer.postgresql.org/pgdocs/postgres/plpgsql-cursors.html It would suffice to explicitly set mycursor to null before doing the OPEN, thus instructing the system to assign a unique cursor name. CREATE FUNCTION test(id integer) RE

Re: [SQL] Cursor names in a self-nested function

2011-08-18 Thread Pavel Stehule
Hello you can use a refcursor type http://developer.postgresql.org/pgdocs/postgres/plpgsql-cursors.html Regards Pavel Stehule 2011/8/18 Kidd, David M : > Hi, > > I am trying to write a function that contains a cursor and iteratively calls > itself. > > It is along the lines of, > > CREATE FUN

Re: [SQL] Cursor

2008-08-19 Thread Fernando Hevia
> De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] En nombre de Xavier Bermeo > Enviado el: Sábado, 16 de Agosto de 2008 14:54 > Para: pgsql-sql@postgresql.org > Asunto: [SQL] Cursor > > Hi, guys... > I have problems with cursosrs. > Anyone have an example co

Re: [SQL] Cursor

2008-08-16 Thread Joe
Xavier Bermeo wrote: Hi, guys... I have problems with cursosrs. Anyone have an example complete the how load and read each position of a cursor? I wait your answer Thanks...guys Assuming you're using ECPG, there are a couple of examples in the documentation, e.g.,

Re: [SQL] cursor and for update

2006-03-28 Thread Wiebe Cazemier
On 03/28/06 11:13, Maciej Piekielniak wrote: >create or replace function uporzadkuj_reguly(text,text) RETURNS VOID AS >' >DECLARE > licznik integer:=1; > > reguly CURSOR FOR SELECT * from firewall ORDER BY id_firewall WHERE > tabela=$1 and lancuch=$2 for UPDATE; >BEGIN > for i in reguly LOOP > U

Re: [SQL] cursor and for update

2006-03-28 Thread Maciej Piekielniak
Hello Wiebe, Tuesday, March 28, 2006, 2:42:20 AM, you wrote: >> WC> Fist, what's the error you get? ERROR: missing ".." at end of SQL expression CONTEXT: compile of PL/pgSQL function "uporzadkuj_reguly" near line 7 WC> Second, what does "rekord" do? You don't seem to use it. Yes, i don't nee

Re: [SQL] cursor and for update

2006-03-27 Thread Wiebe Cazemier
On 03/28/06 01:35, Maciej Piekielniak wrote: >Hello , > >I try to translate my old functions from oracle but don't understand what is >wrong. > >create or replace function uporzadkuj_reguly(text,text) RETURNS integer AS >' >DECLARE > tabela ALIAS FOR $1; > lancuch ALIAS FOR $2; > ret integer:=0;

Re: [SQL] cursor "" already in use

2005-09-02 Thread Michael Fuhr
On Fri, Sep 02, 2005 at 02:17:52PM +0300, Stathis Stergou wrote: > ERROR: cursor "" already in use > CONTEXT: PL/pgSQL function "bufferfeatures" line 19 at open You're trying to open a cursor that's already open. Close the cursor at the end of the loop in which you opened it, so that it gets cl

Re: [SQL] cursor "" does not exist

2005-06-16 Thread Andrew Sullivan
On Wed, Jun 15, 2005 at 06:45:56PM -0400, Vsevolod (Simon) Ilyushchenko wrote: > While those that fail look like this: > > Request select * from material_pkg.ListCautions_fcn($1,$2) as result B > Response result C SELECT > > Note that the successful ones contain strings "S_1" and "BEGIN", and th

Re: [SQL] Cursor need it?

2005-06-08 Thread KÖPFERL Robert
| |I am a new postgres user | |I want to get a list of tables from pg_tables where tables are like |‘%wo%’ (for example).. and then query that list …. | |Select count(*) from tableVARIABLENAMEFROMFIRSTQUERY | |In SQL SERVER I can do that using cursor but in postgresql I don’t |understand how to