Difference between revisions of "NEXTVAL"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 15: Line 15:
  
 
==See Also==
 
==See Also==
[[PSEUDO COLUMNS]], [[SQL INSERT|INSERT]], [[SQL SELECT|SELECT]], [UPDATE]
+
[[PSEUDO COLUMNS]], [[SQL INSERT|INSERT]], [[SQL SELECT|SELECT]], [[SQL UPDATE|UPDATE]]
  
  

Revision as of 12:32, 13 March 2009

NEXTVAL

Class

Pseudo Columns


Purpose

Return the next unique sequence number from the specified table


Syntax

NEXTVAL


See Also

PSEUDO COLUMNS, INSERT, SELECT, UPDATE


Description

A Pseudo Column behaves like a table column, but is not actually stored in the table. You can select from Pseudo Columns, but they cannot be updated. Pseudo Columns provide extra information about a SELECT row set.

The NEXTVAL Pseudo Column will return the next unique sequence number from the specified table. Sequence numbers can be used for primary and unique index keys.


Example

// config.db
set sql to recital
set sql on
// end of config.db
 
CREATE TABLE cust (acc_num INT , acc_name char(20)); 
INSERT INTO cust (acc_num, acc_name) VALUES (NEXTVAL, "Smith");
INSERT INTO cust (acc_name) VALUES ("Brown");
INSERT INTO cust (acc_num, acc_name) VALUES (CURRVAL+2, "Jones");
SELECT * from cust;


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer