[SQL] Cursor Error

2012-04-03 Thread La Chi
Hello every one i have created this function to test cursors , but when i execute this funtion it give me this error , how can i fix this error CREATE OR REPLACE FUNCTION foo(custid int) returns table(userid int) as $BODY$ DECLARE rs cursor for Select customer_name from customer; BEGIN fetch f

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

[SQL] Cursor names in a self-nested function

2011-08-18 Thread 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 FUNCTON test(id integer) RETURNS TEXT AS $BODY$ DECLARE mycursor CURSOR FOR SELECT * FROM myfunction(id); newid INTEGER; out = TEXT; BEGIN out := ''; OPEN mycursor

Re: [SQL] Cursor

2008-08-19 Thread Fernando Hevia
> De: [EMAIL PROTECTED] [mailto:[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 cursosr

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.,

[SQL] Cursor

2008-08-16 Thread Xavier Bermeo
hi guys... This my cursor DECLARE var varchar(15); cursor1 CURSOR FOR select codigo_uni as codigo from recorrido where estado='V'; BEGIN open cursor1; var=cursor1.codigo; END; It's almost 200 records, but, I not unknow how read record for record, I need foun

[SQL] Cursor

2008-08-16 Thread Xavier Bermeo
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

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;

[SQL] cursor and for update

2006-03-27 Thread Maciej Piekielniak
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; licznik integer:=1; rekord firewall%ROWTYPE; reguly C

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

[SQL] cursor "" already in use

2005-09-02 Thread Stathis Stergou
Hi, list. I've created a stored function in plpgsql which uses some functions from postgis. CREATE OR REPLACE FUNCTION "public"."bufferfeatures" (integer [], text, text, double precision) RETURNS SETOF "public"."shapedummy" AS $body$ DECLARE source_layer_features ALIAS FOR $1; source_la

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

[SQL] cursor "" does not exist

2005-06-15 Thread Vsevolod (Simon) Ilyushchenko
Hi, I'm querying a Postgres 8.0.3 database from Java via the 8.0-311 JDBC driver. It mostly works. I ran into the "cursor does not exist" problem, but was able to fix it with connection.setAutoCommit(false); Or so I thought. There are several JSP pages which still throw the 'cursor "portal 1

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

[SQL] Cursor need it?

2005-06-08 Thread Lucas Hernndez
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 use cursor

[SQL] CURSOR EXAMPLE - ORACLE TO POSTGRES CONVERSION

2005-04-06 Thread Dinesh Pandey
Title: CURSOR EXAMPLE - ORACLE TO POSTGRES CONVERSION CURSOR EXAMPLE - ORACLE TO POSTGRES CONVERSION --Oracle CREA

[SQL] Cursor returned from procedure ignores setFetchSize() on CallableStatement

2004-06-07 Thread Brian G. Huber
Hello all - I need to return large result sets and therefore need a cursor with a small fetch size (to avoid caching the entire query at once). However, it appears that when a cursor is returned from a callable statement setFetchSize is ignored. I set up a query that crashes with outofMemoryErro