Friday, 14 February 2014

Add Sequence OR Set Default value to a Table




First we need to create a sequence number. Then we can add this sequence to a table.

Syntax:
ALTER <Table Name> ALTER COLUMN <Column Name> SET DEFAULT NEXTVAL('<Schema Name>.<Sequence Name>');

Example:
ALTER SAMPLE_TBL ALTER COLUMN COL_ID SET DEFAULT NEXTVAL('DEV.MY_SEQ')


See Also:
Drop Sequence on a Table 

No comments:

Post a Comment