Aram
Aram

Reputation: 173

“ORA-00922: missing or invalid option” when trying to insert into table

When i run SQL query in oracle sql developer it is work, but in jdbc this query doesn't work and catch the java.sql.SQLSyntaxErrorException: ORA-00922: missing or invalid option. Could anyone help me ? There is my query below

CREATE GLOBAL TEMPORARY TABLE MY_TABLE (
    ID VARCHAR2(30 BYTE) PRIMARY KEY, 
    NAME VARCHAR2(20 BYTE));
INSERT INTO MY_TABLE (
    ID, NAME)
VALUES ('My_Id' , 'My_Name' );

Upvotes: 4

Views: 7949

Answers (1)

Barny
Barny

Reputation: 1845

It is just a quick guess, because I have no oracle available to proof it, but with MyBatis (which is based on JDBC) I had this behavior with the last ;. Please try to remove it in your JDBC query.

Please create the temporary table in a first statement, then in a second statement add your data.

Upvotes: 13

Related Questions