Consultor Eletrônico



Kbase P156117: Creating view fails with syntax error when applying WITH(NOLOCK) option
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   06/01/2010
Status: Unverified

SYMPTOM(s):

Creating view fails with syntax error when applying WITH(NOLOCK) option

Syntax error in SQL statement at or about "WITH(NOLOCK)" (10713)

FACT(s) (Environment):


SQLExplorer>create view TestViewNL as select * from pub.customer WITH(NOLOCK);
All Supported Operating Systems
OpenEdge 10.2A

CAUSE:

Expected behavior. The SELECT in a view definition, which is in the query expression part of the view predefinition, is not the same as an independent SELECT statement. The "WITH (NOLOCK)" syntax is not allowed in a query expression and so cannot be used on CREATE VIEW.
The reason for this is that the NOLOCK option applies to the entire independent Select statement - that is, it applies to all the table access in the Select. But a view definition is, in effect, a virtual table which can appear in the midst of a Select statement with many other tables - it does not create an independent Select statement.

FIX:

Set the transaction isolation level to Read Uncommitted