Re: Moving around in a SQL database - Mailing list pgsql-sql

From Florian Reiser
Subject Re: Moving around in a SQL database
Date
Msg-id e27v66$2jvn$1@news.hub.org
Whole thread Raw
List pgsql-sql
Hello Willem,

if its not too much data you could do an
select * from table an store the result in an array of rows.
Then you can iterate over it.

If this is too bloated then create a cursor with:

declare <cursorname> .... (refer to 
http://www.postgresql.org/docs/8.1/interactive/sql-declare.html ).
Then use fetch to get the desired row.
After you are finished use CLOSE to close it.

With kind regards

Florian Reiser

-- 
http://www.ra-bc.de
RA Unternehmensberatung
F�hren durch pr�zise Daten

"WillemF" <jwhferguson@zoology.up.ac.za> schrieb im Newsbeitrag 
news:1145533472.685669.176210@i39g2000cwa.googlegroups.com...
>I am a novice to SQL. Hope my naiivity does not show so clearly. After
> consulting the Internet extensively and studying the two thick
> reference books that I have, I cannot find an answer to my problem,
> which I suspect has no immediate solution. I need to move through a
> table and extract the records sequentially one by one and display the
> contents on screen. The order of the records is never changed. I can
> easily create an index and find a record with an instructuion such as
> SELECT * FROM tablename WHILE record_id = 20  , or some similar way.
> But if I need to progress to the next record this is an extremely
> inefficient way to do it since one has to serach the whole database
> just to get to the next record. It would be much easier to have a
> pointer to each of the records in the table and use these pointers to
> directly jump to the appropriate record. In the old days of DBase there
> was an instruction such as GOTO recordnumber. That would set the
> pointer to the appropriate record which could then be accessed. With
> PgSQL being so much more sophisticated than DBase, I am convinced there
> must be an elegant way of solving this problem. Kind regards.
> 




pgsql-sql by date:

Previous
From: Markus Schaber
Date:
Subject: Re: Field length ??
Next
From: "John Goss"
Date:
Subject: At time zone madness!