Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

“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' );
like image 650
Aram Avatar asked Sep 02 '25 15:09

Aram


1 Answers

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.

like image 64
Barny Avatar answered Sep 05 '25 06:09

Barny