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

試著忘記壹切 提交于 2021-01-27 11:37:15

问题


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' );

回答1:


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.



来源:https://stackoverflow.com/questions/30818416/ora-00922-missing-or-invalid-option-when-trying-to-insert-into-table

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!