Thread: Inquiry From Form [pgsql]

Inquiry From Form [pgsql]

From
Rajendran
Date:
I need your help for getting particular records from the table in postgres.
How to use \'fetch\' keyword in postgres.
Can u please give me the syntax to retrieve the no of records in postgres?



Re: Inquiry From Form [pgsql]

From
Christoph Haller
Date:
>
> I am using Java language for getting first 10 records from the table
in postgres.
> I dont know how to fetch 10 records from the table.
> Raj
>
First answer is RTFM. But within psql you can fetch like this:

begin;
declare fu cursor for select * from foo;
fetch 10 in fu;
fetch 10 in fu;
...
close fu;
end;

Does this answer your question?

Regards, Christoph




Re: Inquiry From Form [pgsql]

From
Achilleus Mantzios
Date:
On Fri, 23 May 2003, Christoph Haller wrote:

> >
> > I am using Java language for getting first 10 records from the table
> in postgres.
> > I dont know how to fetch 10 records from the table.
> > Raj
> >

Could you try

selecy name from bar where serves_greek_tsipouro order by price limit 10;

> First answer is RTFM. But within psql you can fetch like this:
> 
> begin;
> declare fu cursor for select * from foo;
> fetch 10 in fu;
> fetch 10 in fu;
> ...
> close fu;
> end;
> 
> Does this answer your question?
> 
> Regards, Christoph
> 
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

-- 
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel:    +30-210-8981112
fax:    +30-210-8981877
email:  achill@matrix.gatewaynet.com       mantzios@softlab.ece.ntua.gr



Re: Inquiry From Form [pgsql]

From
Bruno Wolff III
Date:
On Wed, Jul 02, 2003 at 16:26:09 -0300, Chris Schneider <cschneider@xede.com> wrote:
> I know this is basic, but couldn\'t find and in a hurry to know the answer.  When interfacing with PostgreSQL through
PSQL,it appears that DML statements are auto-commited, that is, a change I make in one session is seen from another
withoutthe original session issueing a COMMIT.  Is this a result of PSQL interface and if so, can it be turned off.  Is
PostgreSQLtransactional in the sense that I can issue several DMLs and then ROLLBACK.  If so, how.  Thanks and sorry
forthe newbie question.
 

Autocommit is the default mode for psql. Use "begin;" to start a transaction.
And use "end;" to end a transaction. Note that unlike in sqlplus with Oracle,
any errors while in the transaction will abort it and you have to start
over.

All DML and most DDL statements are rollbackable by 7.3. I believe in 7.4
all DDL statements will be rollbackable.


Re: Inquiry From Form [pgsql]

From
"scott.marlowe"
Date:
On Thu, 3 Jul 2003, Bruno Wolff III wrote:

> On Wed, Jul 02, 2003 at 16:26:09 -0300,
>   Chris Schneider <cschneider@xede.com> wrote:
> > I know this is basic, but couldn\'t find and in a hurry to know the answer.  When interfacing with PostgreSQL
throughPSQL, it appears that DML statements are auto-commited, that is, a change I make in one session is seen from
anotherwithout the original session issueing a COMMIT.  Is this a result of PSQL interface and if so, can it be turned
off. Is PostgreSQL transactional in the sense that I can issue several DMLs and then ROLLBACK.  If so, how.  Thanks and
sorryfor the newbie question.
 
> 
> Autocommit is the default mode for psql. Use "begin;" to start a transaction.
> And use "end;" to end a transaction. Note that unlike in sqlplus with Oracle,
> any errors while in the transaction will abort it and you have to start
> over.
> 
> All DML and most DDL statements are rollbackable by 7.3. I believe in 7.4
> all DDL statements will be rollbackable.

Except drop database.  That's one that'll probably never be rollbackable 
;^)