Summary -
In this topic, we described about the ALTER Statement with detailed example.
ALTER can be used to add/delete/modify the DB2 Objects which already defined during the CREATE. Primary and foreign key also can be defined by using ALTER once the table got created. For performing ALTER, user required SYSADM or SYSCTRL authority and DBADM authority on DATABASE.
Syntax -
ALTER TABLE table-name ADD column-name declaration;
Similarly the ALTER can be performed on DB2 objects like VIEWS, INDEXes, TABLE SPACES, DATABASES etc,.
Syntax -
ALTER Object-name [Parameters newly added/modified]
Alter can be performed on the below list of Objects.
ALTER ALIAS ALTER DATABASE ALTER FUNCTION ALTER INDEX ALTER PACKAGE ALTER PROCEDURE ALTER ROLE ALTER SEQUENCE ALTER STOGROUP ALTER SYNONYM ALTER TABLE ALTER TABLESPACE ALTER TRIGGER ALTER TYPE ALTER VIEW