Ajax
ASP
C,C++
C#,.NET
CSS,HTML
Delphi,Kylix
Experience
Flash
Java
JavaScript
PHP
Python
QT
SQL
ShellScript
VB
U :
P :
Register
Lost Password
Other Links
Code Archive
Save Giovanni
SQL Category Code
Real Name
:
SharingCode.NET User
Subject
:
Using currval function to get sequence current value
Description
:
Using currval function to get sequence current value
postgres=# postgres=# postgres=# CREATE SEQUENCE myseq MINVALUE 0; CREATE SEQUENCE postgres=# postgres=# -- Using currval(?) postgres=# postgres=# SELECT currval('myseq'); ERROR: currval of sequence "myseq" is not yet defined in this session postgres=# postgres=# postgres=# drop sequence myseq; DROP SEQUENCE postgres=# postgres=# -- Setting a sequence value postgres=# CREATE SEQUENCE myseq MINVALUE 0; CREATE SEQUENCE postgres=# postgres=# SELECT setval('myseq', 1010); setval -------- 1010 (1 row) postgres=# postgres=# SELECT nextval('myseq'); nextval --------- 1011 (1 row) postgres=# postgres=# postgres=# SELECT setval('myseq', 1010, false); setval -------- 1010 (1 row) postgres=# postgres=# SELECT nextval('myseq'); nextval --------- 1010 (1 row) postgres=# postgres=# drop sequence myseq; DROP SEQUENCE postgres=#
Rating
:
1.00
(out of 5)
Visitor Voting Booth
:
Excellent
Very Good
Good
Fair
Poor
Copyright © 2006 SharingCode.NET . All rights reserved. Hosted By: SisNetworks