www.fromthevalley.com.au

Selecting Next Val From Sequence

Examples

Create an ascending sequence called serial, starting at 101:

CREATE SEQUENCE serial START 101;

 

Select the next number from this sequence:

SELECT nextval('serial');
nextval
---------
101

 

Select the next number from this sequence:

SELECT nextval('serial');
nextval
---------
102
HOMEAJAXAPACHEBizphoneCSSDNSGeneralGraphicsHTMLHardwareJavascriptLinuxMACMS SQLMailMicrosoftOFFICE 365PerlPostgresSEOSocial MediaVMwareWindows 10