James Shields
James Shields

Reputation: 339

Entity Framework ExecuteStoreCommand gives {"ORA-00936: missing expression"}

I'm trying to run the following in a VB.NET application using Entity Framework 6 on an Oracle database:

mrstage.ExecuteStoreCommand("DELETE FROM CB_LISTINGS WHERE ELIGIBLE={0}", eligible)

When it executes, I get the error: {"ORA-00936: missing expression"}

On my table, ELIGIBLE is of type VARCHAR2, and the eligible variable is a string.

If I hardcode the parameter, for example:

mrstage.ExecuteStoreCommand("DELETE FROM CB_LISTINGS WHERE ELIGIBLE='ECB'")

It works fine.

I'd be very grateful if someone can offer any suggestions.

Thanks!

James

Upvotes: 1

Views: 660

Answers (1)

DavidG
DavidG

Reputation: 118947

In Oracle parameters are named differently, use a column parameter like :0 instead of {0}.

So your code is now:

mrstage.ExecuteStoreCommand(
    "DELETE FROM CB_LISTINGS WHERE ELIGIBLE=:0",
    eligible)

Upvotes: 4

Related Questions