Neoview SQL Reference Manual (R2.4)

Because the isolation level closest to table t1 is READ UNCOMMITTED, READ UNCOMMITTED
is used when the rows are read.
Nested View Definitions
The semantics used with nested view definitions are the same as those described in “Explicit
User-Specified Isolation Level on SELECT From a View” (page 101). After nested view expansion,
the isolation level closest to the table is used.
For example:
Create view v as select * from t1, t2 for serializable access;
Create view v1 as select * from v for read uncommitted access;
Select * from v1;
In this example, the query becomes:
Select * from (select * from t1,t2 for serializable access) for read uncommitted access;
Because the isolation level closest to table t1 and t2 is SERIALIZABLE access, SERIALIZABLE
access is used when the rows from those tables are read.
ORDER BY Clause Guidelines
The ORDER BY clause can be specified in the SELECT portion of a CREATE VIEW definition.
Any SELECT syntax that is valid when the SELECT portion is specified on its own is also valid
during the view definition. An ORDER BY clause can contain either the column name from the
SELECT list or from select--list-index.
When a DML statement is issued against the view, the rules documented in the following sections
are used to apply the ORDER BY clause.
When to Use ORDER BY
An ORDER BY clause is used in a view definition only when the clause is under the root of the
Select query that uses that view. If the ORDER BY clause appears in other intermediate locations
or in a subquery, it is ignored.
Consider this CREATE VIEW statement:
Create view v as select a from t order by a;
Select * from v x, v y;
Or this INSERT statement:
Insert into t1 select * from v;
In these two examples, the ORDER BY clause is ignored during DML processing because the
first appears as part of a derived table and the second as a subquery selects, both created after
the view expansion.
If the same query is issued using explicit derived tables instead of a view, a syntax error is
returned:
Select * from (select a from t order by a) x, (select a from t order by a) y;
This example returns a syntax error because an ORDER BY clause is not supported in a subquery.
The ORDER BY clause is ignored if it is part of a view and used in places where it is not supported.
This is different than returning an error when the same query was written with explicit ORDER
BY clause, as is shown in the preceding examples.
ORDER BY in a View Definition With No Override
If the SELECT query reads from the view with no explicit ORDER BY override, the ORDER BY
semantics of the view definition are used.
In this example, the ordering column is the one specified in the CREATE VIEW statement:
Create view v as select * from t order by a
Select * from v
102 SQL Statements