Who Can Alter a View?
The ALTER VIEW
statement can be executed by:
-
The owner of the view
-
Users with the
ALTER ANY VIEW
privilege
The ALTER VIEW
statement can be executed by:
The owner of the view
Users with the ALTER ANY VIEW
privilege
ALTER VIEW
PRICE_WITH_MARKUP
ALTER VIEW PRICE_WITH_MARKUP (
CODE_PRICE,
COST,
COST_WITH_MARKUP
) AS
SELECT
CODE_PRICE,
COST,
COST * 1.15
FROM PRICE;
CREATE OR ALTER VIEW
Creates a view if it doesn’t exist, or alters a view
DSQL
CREATE OR ALTER VIEW viewname [<full_column_list>] AS <select_statement> [WITH CHECK OPTION] <full_column_list> ::= (colname [, colname ...])
Parameter | Description |
---|---|
viewname |
Name of a view which may or may not exist |
select_statement |
SELECT statement |
full_column_list |
The list of columns in the view |
colname |
View column name.Duplicate column names are not allowed. |
Use the CREATE OR ALTER VIEW
statement for changing the definition of an existing view or creating it if it does not exist.Privileges for an existing view remain intact and dependencies are not affected.
The syntax of the CREATE OR ALTER VIEW
statement corresponds with that of CREATE VIEW
.
CREATE OR ALTER VIEW
PRICE_WITH_MARKUP
view or altering it if it already existsCREATE OR ALTER VIEW PRICE_WITH_MARKUP (
CODE_PRICE,
COST,
COST_WITH_MARKUP
) AS
SELECT
CODE_PRICE,
COST,
COST * 1.15
FROM PRICE;