Selectiing an Arithmetic Expression from Dual May Fail With: ORA-00936: missing expression (Doc ID 1547817.1)

Last updated on APRIL 25, 2013

Applies to:

Oracle Data Provider for .NET - Version 11.2.0.3 and later
Information in this document applies to any platform.

Symptoms

Attempting to execute the following simple query:

select 4 - .2 from dual

fails with:

ORA-00936: missing expression



Executing .NET code using ODP similar to the following demostrates the issue:

Dim conn As Oracle.DataAccess.Client.OracleConnection = New Oracle.DataAccess.Client.OracleConnection(My.Settings.oraconn)
conn.Open()
Dim da As Oracle.DataAccess.Client.OracleDataAdapter
Dim ds As New DataSet
da = New Oracle.DataAccess.Client.OracleDataAdapter("select 4 - .2 from dual", conn)
da.Fill(ds)
MsgBox(ds.Tables(0).Rows(0)(0))



A 100046 trace that is generated when the error is generated shows the SQL:

select 4-. 2 from dual


ODP.NET changes the SQL and strips out spacing causing the exception.

Executing the same bad SQL from SQL PLUS shows the same error:

SQL> select select 4-. 2 from dual;
select select 4-. 2 from dual
       *
ERROR at line 1:
ORA-00936: missing expression

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms