ORA-00936: missing expression when reading from database with dotConnect driver and oracle database
Asked Answered
L

2

8

I am using dotConnect driver for connecting to oracle database but i always get this error when i want to use parameters: ORA-00936: missing expression

CODE:

using (var cmd = conn.CreateCommand())
            {
                conn.Open();
                cmd.CommandText = "SELECT stevilka_dokumenta from zmpt_dokumenti_po where status = @status"; ;
                cmd.Parameters.Add("@status", OracleDbType.VarChar, "1");

                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        string stevilkaDokumenta = reader.GetString("stevilka_dokumenta");
                    }
                }

Error is here:

using (var reader = cmd.ExecuteReader())

why i get ORA-00936: missing expression? How must i declare input parameters?

Lorileelorilyn answered 6/9, 2011 at 8:17 Comment(0)
R
20

just try changing @status to :status.

Rawdan answered 6/9, 2011 at 8:20 Comment(2)
According to the documentation, the synax in the question is correct, but your answer solved the problem: devart.com/dotconnect/db2/docs/Parameters.htmlAlphonso
@Alphonso it's for Db2 providerWitkowski
R
0

Also, to those still having issues, make sure you don't include a Semicolon at the end...

Repetitious answered 3/11, 2017 at 20:41 Comment(1)
Something along the lines of unrecognized character. It was just a gotcha that I figured I throw out there.Repetitious

© 2022 - 2024 — McMap. All rights reserved.