Referencing Sequences and Altering a sequence Assignment Help

Assignment Help: >> Sequences - Referencing Sequences and Altering a sequence

Referencing Sequences:

A sequence is referenced in SQL statements by using NEXTVAL and CURRVAL pseudocolumns. The NEXTVAL denotes the sequence's new number and CURRVAL denotes the current sequence number.

Example:

SELECT s1. NEXTVAL FROM dual;

 Displays

NEXTVAL

-------

1

This will be used in Insert operations also.

INSERT INTO emp(empno,ename,job) VALUES(s1.NEXTVAL,'gita','manager');

The record would be inserted where the employee number will be the value stored in the NEXTVAL pseudocolumn.

Altering a sequence:

Sequences  can  be  altered  to  perform:   Eliminate  minimum  or Set  or  maximum  value  or altering the incremental values or modifying the number of cached sequence numbers.

ALTER SEQUENCE s1 MAXVALUE 25;

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd