23.10.2012 Views

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

NOW<br />

Syntax<br />

110<br />

schema<br />

sequence<br />

Specifies the schema that contains the sequence. To refer to the next value of a sequence<br />

in the schema of another user, you must have SELECT object privilege on the sequence.<br />

Specifies the name of the sequence whose next value you want.A statement referencing<br />

NEXTVAL for a noncycling sequence returns an error after reaching the maximum value.<br />

Use NEXTVAL in the:<br />

• SELECT list of a SELECT statement not contained in a subquery or view<br />

• SELECT list of a subquery in an INSERT statement<br />

• VALUES clause of an INSERT statement<br />

• SET clause of an UPDATE statement<br />

NEXTVAL cannot be used in:<br />

• A query of a view<br />

• A SELECT statement with a GROUP BY clause that references a sequence<br />

• A SELECT statement with an ORDER BY clause that references a sequence<br />

• A SELECT statement that is combined with another SELECT statement with the UNION,<br />

INTERSECT, or MINUS set operator<br />

• The WHERE clause of a SELECT or UPDATE statement<br />

• The DEFAULT value of a column in a CREATE TABLE or ALTER TABLE statement<br />

• The condition of a CHECK constraint<br />

Example In the following example, the sequence generator increments the customer sequence and uses<br />

its value for a new customer inserted into the table pub.customer:<br />

NOW<br />

Syntax<br />

schema.sequence.NEXTVAL<br />

INSERT INTO pub.customer VALUES<br />

(customer_sequence.NEXTVAL,’USA’,’BackCountry Equipment’,’Sugar Hill<br />

Road’,’12A’,’Franconia’,’NH’,’03242’,’Dan Egan’,’603-762-2121’,’Kirsten<br />

Ulmner’, 10000.00, 500.00,’net 10’, 0,’contact monthly’);<br />

Returns the current date and time as a TIMESTAMP value. This function takes no arguments.<br />

NOW ( )

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!