retun cursor 
Author Message
 retun cursor


> When I do fetch 10 from "unnamed cursor 1"
> It says Query Executed Ok. But when am I really going to see the output?
> When Will I see the records? pLease explain the process.....WHat do I fetch
> the cursor into?

Here's a simple function and a fetch passed in through
psql -e

create table test1(a int);
insert into test1 values (1);
INSERT 156460 1
insert into test1 values (2);
INSERT 156461 1
insert into test1 values (3);
INSERT 156462 1
insert into test1 values (4);
INSERT 156463 1
insert into test1 values (5);
INSERT 156464 1
create function testfunc1(int4) returns refcursor as '
 r refcursor;
 open r for select * from test1 where a>=$1;
 return r;
language 'plpgsql';
select testfunc1(2);
 <unnamed cursor 1>
(1 row)

fetch 1 from "<unnamed cursor 1>";
(1 row)

fetch all from "<unnamed cursor 1>";
(3 rows)


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly

Fri, 24 Sep 2004 13:34:33 GMT
 [ 1 post ] 

 Relevant Pages 

1. retun cursor

2. Retun values in strored procedure

3. Retun Only Fields That contain duplicate information

4. Carriage Retun in SQL

5. Cursor Cursor Cursor

6. SQL Server Cursors vs. Oracle Cursors

7. A cursor within another cursor

8. 40088 No open cursor or cursor closed.

9. Why declare cursor and open cursor both cost same amount of time

10. cursor without cursors

11. help-no open cursor or cursor closed

12. Cursors within cursors

Powered by phpBB® Forum Software