ORA-00922 Missing or Invalid Option when creating a table

ORA-00922 Missing or Invalid Option when creating a table

Postby jthoro » Tue 13 Sep 2016 06:04

I am attempting to create a simple table in Direct mode. I've verified that the connection is open but when I attempt:

OracleCommand cmd = new OracleCommand(sqlOra, connection);
cmd.ExecuteNonQuery();

It fails with the ORA-00922 message. The sqlOra variable seems to be valid. I can paste the text directly into SQL Plus and SQL Developer and it works.

Oracle version = 12c
dotConnect version = 9.1.97

Any help is appreciated.
jthoro
 
Posts: 2
Joined: Tue 13 Sep 2016 05:56

Re: ORA-00922 Missing or Invalid Option when creating a table

Postby Shalex » Wed 14 Sep 2016 15:19

This code works in our environment:
Code: Select all
    var monitor = new OracleMonitor() { IsActive = true };
    using (var connection = new OracleConnection("server=orcl12c;uid=****;pwd=****;")) {
        connection.Open();
        string sqlOra = "CREATE TABLE T1 (ID NUMBER PRIMARY KEY, SOMEDATA VARCHAR2(50))";
        OracleCommand cmd = new OracleCommand(sqlOra, connection);
        cmd.ExecuteNonQuery();
    }

Please tell us how we should modify this sample to reproduce the error you have encountered.
Shalex
Devart Team
 
Posts: 7839
Joined: Thu 14 Aug 2008 12:44

Re: ORA-00922 Missing or Invalid Option when creating a table

Postby jthoro » Wed 14 Sep 2016 15:45

Thank you for the reply.

Your sample helped me find my idiotic mistake. I left a semicolon at the end of the sql statement within the string. I don't know why or when I added it but I certainly overlooked it thinking it was a bigger issue....
jthoro
 
Posts: 2
Joined: Tue 13 Sep 2016 05:56


Return to dotConnect for Oracle