Eric
Eric

Reputation: 3221

ORA-00933: SQL command not properly ended when running create sequence commands

I'm trying to execute some sql using the following C# code:

IDbCommand objOracleCommand = CreateCommand(commandPart, connection, transaction);
objOracleCommand.ExecuteNonQuery();

I'm getting back a "ORA-00933: SQL command not properly ended" error.

commandPart is a string that looks like:

CREATE SEQUENCE seq_1
INCREMENT BY 1
START WITH 1
NOMAXVALUE
NOMINVALUE
NOCACHE
NOCYCLE
NOORDER

CREATE SEQUENCE seq_2 START WITH 1 INCREMENT BY 1

The commandPart is actually being read in from a text file. The original SQL has semi-colons like so:

CREATE SEQUENCE seq_1
INCREMENT BY 1
START WITH 1
NOMAXVALUE
NOMINVALUE
NOCACHE
NOCYCLE
NOORDER;

CREATE SEQUENCE seq_2 START WITH 1 INCREMENT BY 1;

This original snippet (with semi-colons) will run just fine in SQL Developer. If I run the original snippet via C# I get "ora-00911: invalid character". Any ideas?

Thanks, Eric

Upvotes: 1

Views: 4253

Answers (1)

Codo
Codo

Reputation: 78865

Your command part consists of two commands. Oracle is confused because it only expects one command.

You'll need to execute (ExecuteNonQuery) the two commands seperately.

Upvotes: 2

Related Questions